]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCPreferencesInternal.h
b1f669d3f1c80f8edb3dea8b07099abbd9e155fe
[apple/configd.git] / SystemConfiguration.fproj / SCPreferencesInternal.h
1 /*
2 * Copyright (c) 2000-2003 Apple Computer, 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 _SCPREFERENCESINTERNAL_H
25 #define _SCPREFERENCESINTERNAL_H
26
27 #include <sys/types.h>
28 #include <sys/stat.h>
29 #include <sys/time.h>
30 #include <CoreFoundation/CoreFoundation.h>
31 #include <CoreFoundation/CFRuntime.h>
32 #include <SystemConfiguration/SCPreferences.h>
33 #include <SystemConfiguration/SCDynamicStore.h>
34
35
36 #define PREFS_DEFAULT_DIR CFSTR("/Library/Preferences/SystemConfiguration")
37 #define PREFS_DEFAULT_CONFIG CFSTR("preferences.plist")
38
39 #define PREFS_DEFAULT_DIR_OLD CFSTR("/var/db/SystemConfiguration")
40 #define PREFS_DEFAULT_CONFIG_OLD CFSTR("preferences.xml")
41
42 #define PREFS_DEFAULT_USER_DIR CFSTR("Library/Preferences")
43
44
45 /* Define the per-preference-handle structure */
46 typedef struct {
47
48 /* base CFType information */
49 CFRuntimeBase cfBase;
50
51 /* session name */
52 CFStringRef name;
53
54 /* preferences ID */
55 CFStringRef prefsID;
56
57 /* per-user preference info */
58 Boolean perUser;
59 CFStringRef user;
60
61 /* configuration file path */
62 char *path;
63 char *newPath;
64
65 /* configuration file signature */
66 CFDataRef signature;
67
68 /* configd session */
69 SCDynamicStoreRef session;
70
71 /* configd session keys */
72 CFStringRef sessionKeyLock;
73 CFStringRef sessionKeyCommit;
74 CFStringRef sessionKeyApply;
75
76 /* preferences */
77 CFMutableDictionaryRef prefs;
78
79 /* flags */
80 Boolean accessed;
81 Boolean changed;
82 Boolean locked;
83 Boolean isRoot;
84
85 } SCPreferencesPrivate, *SCPreferencesPrivateRef;
86
87
88 /* Define signature data */
89 typedef struct {
90 dev_t st_dev; /* inode's device */
91 ino_t st_ino; /* inode's number */
92 struct timespec st_mtimespec; /* time of last data modification */
93 off_t st_size; /* file size, in bytes */
94 } SCPSignatureData, *SCPSignatureDataRef;
95
96
97 __BEGIN_DECLS
98
99 SCPreferencesRef
100 __SCPreferencesCreate (CFAllocatorRef allocator,
101 CFStringRef name,
102 CFStringRef prefsID,
103 Boolean perUser,
104 CFStringRef user);
105
106 CFDataRef
107 __SCPSignatureFromStatbuf (const struct stat *statBuf);
108
109 char *
110 __SCPreferencesPath (CFAllocatorRef allocator,
111 CFStringRef prefsID,
112 Boolean perUser,
113 CFStringRef user,
114 Boolean useNewPrefs);
115
116 CFStringRef
117 _SCPNotificationKey (CFAllocatorRef allocator,
118 CFStringRef prefsID,
119 Boolean perUser,
120 CFStringRef user,
121 int keyType);
122
123 __END_DECLS
124
125 #endif /* _SCPREFERENCESINTERNAL_H */