]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/v1Compatibility.h
configd-53.tar.gz
[apple/configd.git] / SystemConfiguration.fproj / v1Compatibility.h
1 /*
2 * Copyright (c) 2001 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23 #ifndef _V1COMPATIBILITY_H
24 #define _V1COMPATIBILITY_H
25
26 #include <sys/cdefs.h>
27 #include <sys/types.h>
28 #include <sys/socket.h>
29 #include <sys/syslog.h>
30 #include <mach/message.h>
31 #include <CoreFoundation/CoreFoundation.h>
32
33
34 #define kSCCacheDomainFile kSCDynamicStoreDomainFile
35 #define kSCCacheDomainPlugin kSCDynamicStoreDomainPlugin
36 #define kSCCacheDomainSetup kSCDynamicStoreDomainSetup
37 #define kSCCacheDomainState kSCDynamicStoreDomainState
38 #define kSCCacheDomainPrefs kSCDynamicStoreDomainPrefs
39 #define kSCCachePropSetupCurrentSet kSCDynamicStorePropSetupCurrentSet
40 #define kSCCachePropSetupLastUpdated kSCDynamicStorePropSetupLastUpdated
41 #define kSCCachePropNetInterfaces kSCDynamicStorePropNetInterfaces
42 #define kSCCachePropNetPrimaryInterface kSCDynamicStorePropNetPrimaryInterface
43 #define kSCCachePropNetPrimaryService kSCDynamicStorePropNetPrimaryService
44 #define kSCCachePropNetServiceIDs kSCDynamicStorePropNetServiceIDs
45
46
47 typedef enum {
48 SCD_OK = 0, /* Success */
49 SCD_NOSESSION = 1, /* Configuration daemon session not active */
50 SCD_NOSERVER = 2, /* Configuration daemon not (no longer) available */
51 SCD_LOCKED = 3, /* Lock already held */
52 SCD_NEEDLOCK = 4, /* Lock required for this operation */
53 SCD_EACCESS = 5, /* Permission denied (must be root to obtain lock) */
54 SCD_NOKEY = 6, /* No such key */
55 SCD_EXISTS = 7, /* Data associated with key already defined */
56 SCD_STALE = 8, /* Write attempted on stale version of object */
57 SCD_INVALIDARGUMENT = 9, /* Invalid argument */
58 SCD_NOTIFIERACTIVE = 10, /* Notifier is currently active */
59 SCD_FAILED = 9999 /* Generic error */
60 } SCDStatus;
61
62 typedef const struct __SCDSession * SCDSessionRef;
63
64 typedef const struct __SCDHandle * SCDHandleRef;
65
66 typedef enum {
67 kSCDRegexKey = 0100000, /* pattern string is a regular expression */
68 } SCDKeyOption;
69
70 typedef enum {
71 kSCDOptionDebug = 0, /* Enable debugging */
72 kSCDOptionVerbose = 1, /* Enable verbose logging */
73 kSCDOptionUseSyslog = 2, /* Use syslog(3) for log messages */
74 kSCDOptionUseCFRunLoop = 3, /* Calling application is CFRunLoop() based */
75 } SCDOption;
76
77 typedef boolean_t (*SCDCallbackRoutine_t) (SCDSessionRef session,
78 void *context);
79
80 typedef void (*SCDBundleStartRoutine_t) (const char *bundlePath,
81 const char *bundleName);
82
83 typedef void (*SCDBundlePrimeRoutine_t) ();
84
85 typedef enum {
86 SCP_OK = 0, /* Success */
87 SCP_NOSESSION = 1024, /* Preference session not active */
88 SCP_BUSY = 1025, /* Preferences update currently in progress */
89 SCP_NEEDLOCK = 1026, /* Lock required for this operation */
90 SCP_EACCESS = 1027, /* Permission denied */
91 SCP_ENOENT = 1028, /* Configuration file not found */
92 SCP_BADCF = 1029, /* Configuration file corrupt */
93 SCP_NOKEY = 1030, /* No such key */
94 SCP_NOLINK = 1031, /* No such link */
95 SCP_EXISTS = 1032, /* No such key */
96 SCP_STALE = 1033, /* Write attempted on stale version of object */
97 SCP_INVALIDARGUMENT = 1034, /* Invalid argument */
98 SCP_FAILED = 9999 /* Generic error */
99 } SCPStatus;
100
101 typedef enum {
102 kSCPOpenCreatePrefs = 1, /* create preferences file if not found */
103 } SCPOption;
104
105 typedef enum {
106 kSCPKeyLock = 1,
107 kSCPKeyCommit = 2,
108 kSCPKeyApply = 3,
109 } SCPKeyType;
110
111 typedef void * SCPSessionRef;
112
113 typedef enum {
114 SCN_REACHABLE_UNKNOWN = -1,
115 SCN_REACHABLE_NO = 0,
116 SCN_REACHABLE_CONNECTION_REQUIRED = 1,
117 SCN_REACHABLE_YES = 2,
118 } SCNStatus;
119
120 typedef enum {
121 kSCNFlagsTransientConnection = 1<<0,
122 kSCNFlagsConnectionAutomatic = 1<<1,
123 kSCNFlagsInterventionRequired = 1<<2,
124 } SCNConnectionFlags;
125
126 __BEGIN_DECLS
127
128 /*
129 * handle APIs
130 */
131
132 SCDHandleRef SCDHandleInit ();
133
134 void SCDHandleRelease (SCDHandleRef handle);
135
136 int SCDHandleGetInstance (SCDHandleRef handle);
137
138 void _SCDHandleSetInstance (SCDHandleRef handle,
139 int instance);
140
141 CFPropertyListRef SCDHandleGetData (SCDHandleRef handle);
142
143 void SCDHandleSetData (SCDHandleRef handle,
144 CFPropertyListRef data);
145
146 /*
147 * store access APIs
148 */
149
150 SCDStatus SCDOpen (SCDSessionRef *session,
151 CFStringRef name);
152
153 SCDStatus SCDClose (SCDSessionRef *session);
154
155 SCDStatus SCDLock (SCDSessionRef session);
156
157 SCDStatus SCDUnlock (SCDSessionRef session);
158
159 SCDStatus SCDList (SCDSessionRef session,
160 CFStringRef key,
161 int regexOptions,
162 CFArrayRef *subKeys);
163
164 SCDStatus SCDAdd (SCDSessionRef session,
165 CFStringRef key,
166 SCDHandleRef handle);
167
168 SCDStatus SCDAddSession (SCDSessionRef session,
169 CFStringRef key,
170 SCDHandleRef handle);
171
172 SCDStatus SCDGet (SCDSessionRef session,
173 CFStringRef key,
174 SCDHandleRef *handle);
175
176 SCDStatus SCDSet (SCDSessionRef session,
177 CFStringRef key,
178 SCDHandleRef handle);
179
180 SCDStatus SCDRemove (SCDSessionRef session,
181 CFStringRef key);
182
183 SCDStatus SCDTouch (SCDSessionRef session,
184 CFStringRef key);
185
186 SCDStatus SCDNotifierList (SCDSessionRef session,
187 int regexOptions,
188 CFArrayRef *changedKeys);
189
190 SCDStatus SCDNotifierAdd (SCDSessionRef session,
191 CFStringRef key,
192 int regexOptions);
193
194 SCDStatus SCDNotifierRemove (SCDSessionRef session,
195 CFStringRef key,
196 int regexOptions);
197
198 SCDStatus SCDNotifierGetChanges (SCDSessionRef session,
199 CFArrayRef *notifierKeys);
200
201 SCDStatus SCDNotifierWait (SCDSessionRef session);
202
203 SCDStatus SCDNotifierInformViaCallback (SCDSessionRef session,
204 SCDCallbackRoutine_t func,
205 void *arg);
206
207 SCDStatus SCDNotifierInformViaMachPort (SCDSessionRef session,
208 mach_msg_id_t msgid,
209 mach_port_t *port);
210
211 SCDStatus SCDNotifierInformViaFD (SCDSessionRef session,
212 int32_t identifier,
213 int *fd);
214
215 SCDStatus SCDNotifierInformViaSignal (SCDSessionRef session,
216 pid_t pid,
217 int sig);
218
219 SCDStatus SCDNotifierCancel (SCDSessionRef session);
220
221 SCDStatus SCDSnapshot (SCDSessionRef session);
222
223 int SCDOptionGet (SCDSessionRef session,
224 int option);
225
226 void SCDOptionSet (SCDSessionRef session,
227 int option,
228 int value);
229
230 void SCDSessionLog (SCDSessionRef session,
231 int level,
232 CFStringRef formatString,
233 ...);
234
235 void SCDLog (int level,
236 CFStringRef formatString,
237 ...);
238
239 const char * SCDError (SCDStatus status);
240
241 /*
242 * store/preference keys
243 */
244
245 CFStringRef SCDKeyCreate (CFStringRef fmt,
246 ...);
247
248 CFStringRef SCDKeyCreateNetworkGlobalEntity (CFStringRef domain,
249 CFStringRef entity);
250
251 CFStringRef SCDKeyCreateNetworkInterface (CFStringRef domain);
252
253 CFStringRef SCDKeyCreateNetworkInterfaceEntity (CFStringRef domain,
254 CFStringRef ifname,
255 CFStringRef entity);
256
257 CFStringRef SCDKeyCreateNetworkServiceEntity (CFStringRef domain,
258 CFStringRef serviceID,
259 CFStringRef entity);
260
261 /*
262 * preference APIs
263 */
264
265 SCPStatus SCPOpen (SCPSessionRef *session,
266 CFStringRef name,
267 CFStringRef prefsID,
268 int options);
269
270 SCPStatus SCPUserOpen (SCPSessionRef *session,
271 CFStringRef name,
272 CFStringRef prefsID,
273 CFStringRef user,
274 int options);
275
276 SCPStatus SCPClose (SCPSessionRef *session);
277
278 SCPStatus SCPLock (SCPSessionRef session,
279 boolean_t wait);
280
281 SCPStatus SCPCommit (SCPSessionRef session);
282
283 SCPStatus SCPApply (SCPSessionRef session);
284
285 SCPStatus SCPUnlock (SCPSessionRef session);
286
287 SCPStatus SCPGetSignature (SCPSessionRef session,
288 CFDataRef *signature);
289
290 SCPStatus SCPList (SCPSessionRef session,
291 CFArrayRef *keys);
292
293 SCPStatus SCPGet (SCPSessionRef session,
294 CFStringRef key,
295 CFPropertyListRef *data);
296
297 SCPStatus SCPAdd (SCPSessionRef session,
298 CFStringRef key,
299 CFPropertyListRef data);
300
301 SCPStatus SCPSet (SCPSessionRef session,
302 CFStringRef key,
303 CFPropertyListRef data);
304
305 SCPStatus SCPRemove (SCPSessionRef session,
306 CFStringRef key);
307
308 SCPStatus SCPPathCreateUniqueChild (SCPSessionRef session,
309 CFStringRef prefix,
310 CFStringRef *newPath);
311
312 SCPStatus SCPPathGetValue (SCPSessionRef session,
313 CFStringRef path,
314 CFDictionaryRef *value);
315
316 SCPStatus SCPPathGetLink (SCPSessionRef session,
317 CFStringRef path,
318 CFStringRef *link);
319
320 SCPStatus SCPPathSetValue (SCPSessionRef session,
321 CFStringRef path,
322 CFDictionaryRef value);
323
324 SCPStatus SCPPathSetLink (SCPSessionRef session,
325 CFStringRef path,
326 CFStringRef link);
327
328 SCPStatus SCPPathRemove (SCPSessionRef session,
329 CFStringRef path);
330
331 CFStringRef SCPNotificationKeyCreate (CFStringRef prefsID,
332 int keyType);
333
334 CFStringRef SCPUserNotificationKeyCreate (CFStringRef prefsID,
335 CFStringRef user,
336 int keyType);
337
338 const char * SCPError (SCPStatus status);
339
340 /*
341 * console user APIs
342 */
343
344 CFStringRef SCDKeyCreateConsoleUser ();
345
346 SCDStatus SCDConsoleUserGet (char *user,
347 int userlen,
348 uid_t *uid,
349 gid_t *gid);
350
351 SCDStatus SCDConsoleUserSet (const char *user,
352 uid_t uid,
353 gid_t gid);
354
355 /*
356 * host name APIs
357 */
358
359 CFStringRef SCDKeyCreateHostName ();
360
361 SCDStatus SCDHostNameGet (CFStringRef *name,
362 CFStringEncoding *nameEncoding);
363
364 /*
365 * network reachability APIs
366 */
367 SCNStatus SCNIsReachableByAddress (const struct sockaddr *address,
368 const int addrlen,
369 int *flags,
370 const char **errorMessage);
371
372 SCNStatus SCNIsReachableByName (const char *nodename,
373 int *flags,
374 const char **errorMessage);
375
376 __END_DECLS
377
378 #endif /* _V1COMPATIBILITY_H */