2 * Copyright (c) 2000-2004, 2006, 2008-2010, 2012, 2015 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 #ifndef _SYSTEMCONFIGURATION_H
25 #define _SYSTEMCONFIGURATION_H
27 #include <Availability.h>
28 #include <sys/cdefs.h>
29 #include <CoreFoundation/CoreFoundation.h>
33 @header SystemConfiguration
34 @discussion The System Configuration framework provides access to the
35 data used to configure a running system. The APIs provided
36 by this framework communicate with the configd daemon.
38 The configd daemon manages a dynamic store reflecting the
39 desired configuration settings as well as the current state
40 of the system. The daemon provides a notification mechanism
41 for processes that need to be aware of changes made to the
42 data. Lastly, the daemon loads a number of bundles (or
43 plug-ins) that monitor low-level kernel events and, through
44 a set of policy modules, keep the state data up to date.
49 @discussion Returned error codes.
50 @constant kSCStatusOK Success
51 @constant kSCStatusFailed Non-specific Failure
52 @constant kSCStatusInvalidArgument Invalid argument
53 @constant kSCStatusAccessError Permission denied
54 @constant kSCStatusNoKey No such key
55 @constant kSCStatusKeyExists Data associated with key already defined
56 @constant kSCStatusLocked Lock already held
57 @constant kSCStatusNeedLock Lock required for this operation
58 @constant kSCStatusNoStoreSession Configuration daemon session not active
59 @constant kSCStatusNoStoreServer Configuration daemon not (or no longer) available
60 @constant kSCStatusNotifierActive Notifier is currently active
61 @constant kSCStatusNoPrefsSession Preferences session not active
62 @constant kSCStatusPrefsBusy Preferences update currently in progress
63 @constant kSCStatusNoConfigFile Configuration file not found
64 @constant kSCStatusNoLink No such link
65 @constant kSCStatusStale Write attempted on stale version of object
66 @constant kSCStatusMaxLink Maximum link count exceeded
67 @constant kSCStatusReachabilityUnknown
68 A determination could not be made regarding the reachability
69 of the specified nodename or address.
70 @constant kSCStatusConnectionNoService Network service for connection not available
76 kSCStatusOK
= 0, /* Success */
77 kSCStatusFailed
= 1001, /* Non-specific failure */
78 kSCStatusInvalidArgument
= 1002, /* Invalid argument */
79 kSCStatusAccessError
= 1003, /* Permission denied
80 - must be root to obtain lock
81 - could not create access/create preferences
83 kSCStatusNoKey
= 1004, /* No such key */
84 kSCStatusKeyExists
= 1005, /* Key already defined */
85 kSCStatusLocked
= 1006, /* Lock already held */
86 kSCStatusNeedLock
= 1007, /* Lock required for this operation */
88 * SCDynamicStore error codes
90 kSCStatusNoStoreSession
= 2001, /* Configuration daemon session not active */
91 kSCStatusNoStoreServer
= 2002, /* Configuration daemon not (no longer) available */
92 kSCStatusNotifierActive
= 2003, /* Notifier is currently active */
94 * SCPreferences error codes
96 kSCStatusNoPrefsSession
= 3001, /* Preference session not active */
97 kSCStatusPrefsBusy
= 3002, /* Preferences update currently in progress */
98 kSCStatusNoConfigFile
= 3003, /* Configuration file not found */
99 kSCStatusNoLink
= 3004, /* No such link */
100 kSCStatusStale
= 3005, /* Write attempted on stale version of object */
101 kSCStatusMaxLink
= 3006, /* Maximum link count exceeded */
103 * SCNetwork error codes
105 kSCStatusReachabilityUnknown
= 4001, /* Network reachability cannot be determined */
107 * SCNetworkConnection error codes
109 kSCStatusConnectionNoService
= 5001, /* Network service for connection not available
110 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0)
112 kSCStatusConnectionIgnore
= 5002, /* Network connection information not available at this time
113 __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_6_0)
118 /* SCDynamicStore APIs */
119 #include <SystemConfiguration/SCDynamicStore.h>
120 #include <SystemConfiguration/SCDynamicStoreKey.h>
121 #include <SystemConfiguration/SCDynamicStoreCopySpecific.h>
123 /* SCPreferences APIs */
124 #include <SystemConfiguration/SCPreferences.h>
125 #include <SystemConfiguration/SCPreferencesPath.h>
126 #include <SystemConfiguration/SCPreferencesSetSpecific.h>
128 /* Schema Definitions (for SCDynamicStore and SCPreferences) */
129 #include <SystemConfiguration/SCSchemaDefinitions.h>
131 /* SCNetworkConfiguration APIs */
132 #include <SystemConfiguration/SCNetworkConfiguration.h>
134 /* SCNetworkReachability and SCNetworkConnection APIs */
135 #include <SystemConfiguration/SCNetwork.h>
136 #include <SystemConfiguration/SCNetworkReachability.h>
137 #include <SystemConfiguration/SCNetworkConnection.h>
139 CF_IMPLICIT_BRIDGING_ENABLED
140 CF_ASSUME_NONNULL_BEGIN
143 @const kCFErrorDomainSystemConfiguration
144 @discussion CFError domain associated with errors reported by
145 the SystemConfiguration.framework.
147 extern const CFStringRef kCFErrorDomainSystemConfiguration
__OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
152 @function SCCopyLastError
153 @discussion Returns the most recent status or error code generated
154 as the result of calling a System Configuration framework API.
155 @result Returns the last error encountered.
157 CFErrorRef
SCCopyLastError (void) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
161 @discussion Returns the most recent status or error code generated
162 as the result of calling a System Configuration framework API.
163 @result Returns the last error encountered.
165 int SCError (void) __OSX_AVAILABLE_STARTING(__MAC_10_1
,__IPHONE_2_0
);
168 @function SCErrorString
169 @discussion Returns a pointer to the message string
170 associated with the specified status or error.
171 @param status The SCDynamicStoreStatus to be returned.
172 @result Returns a pointer to the error message string.
174 const char * SCErrorString (int status
) __OSX_AVAILABLE_STARTING(__MAC_10_1
,__IPHONE_2_0
);
178 CF_ASSUME_NONNULL_END
179 CF_IMPLICIT_BRIDGING_DISABLED
181 #endif /* _SYSTEMCONFIGURATION_H */