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