2 * Copyright (c) 2001 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
23 #ifndef _V1COMPATIBILITY_H
24 #define _V1COMPATIBILITY_H
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>
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
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 */
62 typedef const struct __SCDSession
* SCDSessionRef
;
64 typedef const struct __SCDHandle
* SCDHandleRef
;
67 kSCDRegexKey
= 0100000, /* pattern string is a regular expression */
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 */
77 typedef boolean_t (*SCDCallbackRoutine_t
) (SCDSessionRef session
,
80 typedef void (*SCDBundleStartRoutine_t
) (const char *bundlePath
,
81 const char *bundleName
);
83 typedef void (*SCDBundlePrimeRoutine_t
) ();
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 */
102 kSCPOpenCreatePrefs
= 1, /* create preferences file if not found */
111 typedef void * SCPSessionRef
;
114 SCN_REACHABLE_UNKNOWN
= -1,
115 SCN_REACHABLE_NO
= 0,
116 SCN_REACHABLE_CONNECTION_REQUIRED
= 1,
117 SCN_REACHABLE_YES
= 2,
121 kSCNFlagsTransientConnection
= 1<<0,
122 kSCNFlagsConnectionAutomatic
= 1<<1,
123 kSCNFlagsInterventionRequired
= 1<<2,
124 } SCNConnectionFlags
;
132 SCDHandleRef
SCDHandleInit ();
134 void SCDHandleRelease (SCDHandleRef handle
);
136 int SCDHandleGetInstance (SCDHandleRef handle
);
138 void _SCDHandleSetInstance (SCDHandleRef handle
,
141 CFPropertyListRef
SCDHandleGetData (SCDHandleRef handle
);
143 void SCDHandleSetData (SCDHandleRef handle
,
144 CFPropertyListRef data
);
150 SCDStatus
SCDOpen (SCDSessionRef
*session
,
153 SCDStatus
SCDClose (SCDSessionRef
*session
);
155 SCDStatus
SCDLock (SCDSessionRef session
);
157 SCDStatus
SCDUnlock (SCDSessionRef session
);
159 SCDStatus
SCDList (SCDSessionRef session
,
162 CFArrayRef
*subKeys
);
164 SCDStatus
SCDAdd (SCDSessionRef session
,
166 SCDHandleRef handle
);
168 SCDStatus
SCDAddSession (SCDSessionRef session
,
170 SCDHandleRef handle
);
172 SCDStatus
SCDGet (SCDSessionRef session
,
174 SCDHandleRef
*handle
);
176 SCDStatus
SCDSet (SCDSessionRef session
,
178 SCDHandleRef handle
);
180 SCDStatus
SCDRemove (SCDSessionRef session
,
183 SCDStatus
SCDTouch (SCDSessionRef session
,
186 SCDStatus
SCDNotifierList (SCDSessionRef session
,
188 CFArrayRef
*changedKeys
);
190 SCDStatus
SCDNotifierAdd (SCDSessionRef session
,
194 SCDStatus
SCDNotifierRemove (SCDSessionRef session
,
198 SCDStatus
SCDNotifierGetChanges (SCDSessionRef session
,
199 CFArrayRef
*notifierKeys
);
201 SCDStatus
SCDNotifierWait (SCDSessionRef session
);
203 SCDStatus
SCDNotifierInformViaCallback (SCDSessionRef session
,
204 SCDCallbackRoutine_t func
,
207 SCDStatus
SCDNotifierInformViaMachPort (SCDSessionRef session
,
211 SCDStatus
SCDNotifierInformViaFD (SCDSessionRef session
,
215 SCDStatus
SCDNotifierInformViaSignal (SCDSessionRef session
,
219 SCDStatus
SCDNotifierCancel (SCDSessionRef session
);
221 SCDStatus
SCDSnapshot (SCDSessionRef session
);
223 int SCDOptionGet (SCDSessionRef session
,
226 void SCDOptionSet (SCDSessionRef session
,
230 void SCDSessionLog (SCDSessionRef session
,
232 CFStringRef formatString
,
235 void SCDLog (int level
,
236 CFStringRef formatString
,
239 const char * SCDError (SCDStatus status
);
242 * store/preference keys
245 CFStringRef
SCDKeyCreate (CFStringRef fmt
,
248 CFStringRef
SCDKeyCreateNetworkGlobalEntity (CFStringRef domain
,
251 CFStringRef
SCDKeyCreateNetworkInterface (CFStringRef domain
);
253 CFStringRef
SCDKeyCreateNetworkInterfaceEntity (CFStringRef domain
,
257 CFStringRef
SCDKeyCreateNetworkServiceEntity (CFStringRef domain
,
258 CFStringRef serviceID
,
265 SCPStatus
SCPOpen (SCPSessionRef
*session
,
270 SCPStatus
SCPUserOpen (SCPSessionRef
*session
,
276 SCPStatus
SCPClose (SCPSessionRef
*session
);
278 SCPStatus
SCPLock (SCPSessionRef session
,
281 SCPStatus
SCPCommit (SCPSessionRef session
);
283 SCPStatus
SCPApply (SCPSessionRef session
);
285 SCPStatus
SCPUnlock (SCPSessionRef session
);
287 SCPStatus
SCPGetSignature (SCPSessionRef session
,
288 CFDataRef
*signature
);
290 SCPStatus
SCPList (SCPSessionRef session
,
293 SCPStatus
SCPGet (SCPSessionRef session
,
295 CFPropertyListRef
*data
);
297 SCPStatus
SCPAdd (SCPSessionRef session
,
299 CFPropertyListRef data
);
301 SCPStatus
SCPSet (SCPSessionRef session
,
303 CFPropertyListRef data
);
305 SCPStatus
SCPRemove (SCPSessionRef session
,
308 SCPStatus
SCPPathCreateUniqueChild (SCPSessionRef session
,
310 CFStringRef
*newPath
);
312 SCPStatus
SCPPathGetValue (SCPSessionRef session
,
314 CFDictionaryRef
*value
);
316 SCPStatus
SCPPathGetLink (SCPSessionRef session
,
320 SCPStatus
SCPPathSetValue (SCPSessionRef session
,
322 CFDictionaryRef value
);
324 SCPStatus
SCPPathSetLink (SCPSessionRef session
,
328 SCPStatus
SCPPathRemove (SCPSessionRef session
,
331 CFStringRef
SCPNotificationKeyCreate (CFStringRef prefsID
,
334 CFStringRef
SCPUserNotificationKeyCreate (CFStringRef prefsID
,
338 const char * SCPError (SCPStatus status
);
344 CFStringRef
SCDKeyCreateConsoleUser ();
346 SCDStatus
SCDConsoleUserGet (char *user
,
351 SCDStatus
SCDConsoleUserSet (const char *user
,
359 CFStringRef
SCDKeyCreateHostName ();
361 SCDStatus
SCDHostNameGet (CFStringRef
*name
,
362 CFStringEncoding
*nameEncoding
);
365 * network reachability APIs
367 SCNStatus
SCNIsReachableByAddress (const struct sockaddr
*address
,
370 const char **errorMessage
);
372 SCNStatus
SCNIsReachableByName (const char *nodename
,
374 const char **errorMessage
);
378 #endif /* _V1COMPATIBILITY_H */