]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SystemConfiguration.h
configd-1061.0.2.tar.gz
[apple/configd.git] / SystemConfiguration.fproj / SystemConfiguration.h
1 /*
2 * Copyright (c) 2000-2004, 2006, 2008-2010, 2012, 2015, 2018 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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
11 * file.
12 *
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.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifndef _SYSTEMCONFIGURATION_H
25 #define _SYSTEMCONFIGURATION_H
26
27 #include <os/availability.h>
28 #include <sys/cdefs.h>
29 #include <CoreFoundation/CoreFoundation.h>
30
31
32 /*!
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.
37
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.
45 */
46
47 /*!
48 @enum Error codes
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
71 */
72 enum {
73 /*
74 * Generic error codes
75 */
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
82 */
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 */
87 /*
88 * SCDynamicStore error codes
89 */
90 kSCStatusNoStoreSession = 2001, /* Configuration daemon session not active */
91 kSCStatusNoStoreServer = 2002, /* Configuration daemon not (no longer) available */
92 kSCStatusNotifierActive = 2003, /* Notifier is currently active */
93 /*
94 * SCPreferences error codes
95 */
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 */
102 /*
103 * SCNetwork error codes
104 */
105 kSCStatusReachabilityUnknown = 4001, /* Network reachability cannot be determined */
106 /*
107 * SCNetworkConnection error codes
108 */
109 kSCStatusConnectionNoService
110 API_AVAILABLE(macos(6.0))
111 SPI_AVAILABLE(ios(2.0), tvos(9.0), watchos(1.0), bridgeos(1.0))
112 = 5001, /* Network service for connection not available */
113 kSCStatusConnectionIgnore
114 API_AVAILABLE(macos(9.0))
115 SPI_AVAILABLE(ios(6.0), tvos(9.0), watchos(1.0), bridgeos(1.0))
116 = 5002, /* Network connection information not available at this time */
117 };
118
119
120 /* SCDynamicStore APIs */
121 #include <SystemConfiguration/SCDynamicStore.h>
122 #include <SystemConfiguration/SCDynamicStoreKey.h>
123 #include <SystemConfiguration/SCDynamicStoreCopySpecific.h>
124
125 /* SCPreferences APIs */
126 #include <SystemConfiguration/SCPreferences.h>
127 #include <SystemConfiguration/SCPreferencesPath.h>
128 #include <SystemConfiguration/SCPreferencesSetSpecific.h>
129
130 /* Schema Definitions (for SCDynamicStore and SCPreferences) */
131 #include <SystemConfiguration/SCSchemaDefinitions.h>
132
133 /* SCNetworkConfiguration APIs */
134 #include <SystemConfiguration/SCNetworkConfiguration.h>
135
136 /* SCNetworkReachability and SCNetworkConnection APIs */
137 #include <SystemConfiguration/SCNetwork.h>
138 #include <SystemConfiguration/SCNetworkReachability.h>
139 #include <SystemConfiguration/SCNetworkConnection.h>
140
141 CF_IMPLICIT_BRIDGING_ENABLED
142 CF_ASSUME_NONNULL_BEGIN
143
144 /*!
145 @const kCFErrorDomainSystemConfiguration
146 @discussion CFError domain associated with errors reported by
147 the SystemConfiguration.framework.
148 */
149 extern const CFStringRef kCFErrorDomainSystemConfiguration API_AVAILABLE(macos(10.5), ios(2.0));
150
151 __BEGIN_DECLS
152
153 /*!
154 @function SCCopyLastError
155 @discussion Returns the most recent status or error code generated
156 as the result of calling a System Configuration framework API.
157 @result Returns the last error encountered.
158 */
159 CFErrorRef SCCopyLastError (void) API_AVAILABLE(macos(10.5), ios(2.0));
160
161 /*!
162 @function SCError
163 @discussion Returns the most recent status or error code generated
164 as the result of calling a System Configuration framework API.
165 @result Returns the last error encountered.
166 */
167 int SCError (void) API_AVAILABLE(macos(10.1), ios(2.0));
168
169 /*!
170 @function SCErrorString
171 @discussion Returns a pointer to the message string
172 associated with the specified status or error
173 number.
174 @param status The status or error number.
175 @result Returns a pointer to the error message string.
176 */
177 const char * SCErrorString (int status) API_AVAILABLE(macos(10.1), ios(2.0));
178
179 __END_DECLS
180
181 CF_ASSUME_NONNULL_END
182 CF_IMPLICIT_BRIDGING_DISABLED
183
184 #endif /* _SYSTEMCONFIGURATION_H */