]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCPreferencesInternal.h
488e5d7d79e15de9f0822fab6634ec8420f0c3c7
[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 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25
26 #ifndef _SCPREFERENCESINTERNAL_H
27 #define _SCPREFERENCESINTERNAL_H
28
29 #include <sys/types.h>
30 #include <sys/stat.h>
31 #include <sys/time.h>
32 #include <CoreFoundation/CoreFoundation.h>
33 #include <CoreFoundation/CFRuntime.h>
34 #include <SystemConfiguration/SCPreferences.h>
35 #include <SystemConfiguration/SCDynamicStore.h>
36
37
38 #define PREFS_DEFAULT_DIR CFSTR("/Library/Preferences/SystemConfiguration")
39 #define PREFS_DEFAULT_CONFIG CFSTR("preferences.plist")
40
41 #define PREFS_DEFAULT_DIR_OLD CFSTR("/var/db/SystemConfiguration")
42 #define PREFS_DEFAULT_CONFIG_OLD CFSTR("preferences.xml")
43
44 #define PREFS_DEFAULT_USER_DIR CFSTR("Library/Preferences")
45
46
47 /* Define the per-preference-handle structure */
48 typedef struct {
49
50 /* base CFType information */
51 CFRuntimeBase cfBase;
52
53 /* session name */
54 CFStringRef name;
55
56 /* preferences ID */
57 CFStringRef prefsID;
58
59 /* per-user preference info */
60 Boolean perUser;
61 CFStringRef user;
62
63 /* configuration file path */
64 char *path;
65 char *newPath;
66
67 /* configuration file signature */
68 CFDataRef signature;
69
70 /* configd session */
71 SCDynamicStoreRef session;
72
73 /* configd session keys */
74 CFStringRef sessionKeyLock;
75 CFStringRef sessionKeyCommit;
76 CFStringRef sessionKeyApply;
77
78 /* preferences */
79 CFMutableDictionaryRef prefs;
80
81 /* flags */
82 Boolean accessed;
83 Boolean changed;
84 Boolean locked;
85 Boolean isRoot;
86
87 } SCPreferencesPrivate, *SCPreferencesPrivateRef;
88
89
90 /* Define signature data */
91 typedef struct {
92 dev_t st_dev; /* inode's device */
93 ino_t st_ino; /* inode's number */
94 struct timespec st_mtimespec; /* time of last data modification */
95 off_t st_size; /* file size, in bytes */
96 } SCPSignatureData, *SCPSignatureDataRef;
97
98
99 __BEGIN_DECLS
100
101 SCPreferencesRef
102 __SCPreferencesCreate (CFAllocatorRef allocator,
103 CFStringRef name,
104 CFStringRef prefsID,
105 Boolean perUser,
106 CFStringRef user);
107
108 CFDataRef
109 __SCPSignatureFromStatbuf (const struct stat *statBuf);
110
111 char *
112 __SCPreferencesPath (CFAllocatorRef allocator,
113 CFStringRef prefsID,
114 Boolean perUser,
115 CFStringRef user,
116 Boolean useNewPrefs);
117
118 CFStringRef
119 _SCPNotificationKey (CFAllocatorRef allocator,
120 CFStringRef prefsID,
121 Boolean perUser,
122 CFStringRef user,
123 int keyType);
124
125 __END_DECLS
126
127 #endif /* _SCPREFERENCESINTERNAL_H */