]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCPreferencesInternal.h
971cae9af80255c42efb2d246a690fe500a1129b
[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 /* lock */
52 pthread_mutex_t lock;
53
54 /* session name */
55 CFStringRef name;
56
57 /* preferences ID */
58 CFStringRef prefsID;
59
60 /* per-user preference info */
61 Boolean perUser;
62 CFStringRef user;
63
64 /* configuration file */
65 char *path;
66 char *newPath;
67
68 /* configuration file signature */
69 CFDataRef signature;
70
71 /* configd session */
72 SCDynamicStoreRef session;
73
74 /* configd session keys */
75 CFStringRef sessionKeyLock;
76 CFStringRef sessionKeyCommit;
77 CFStringRef sessionKeyApply;
78
79 /* run loop source, callout, context, rl scheduling info */
80 CFRunLoopSourceRef rls;
81 SCPreferencesCallBack rlsFunction;
82 SCPreferencesContext rlsContext;
83 CFMutableArrayRef rlList;
84
85 /* preferences */
86 CFMutableDictionaryRef prefs;
87
88 /* flags */
89 Boolean accessed;
90 Boolean changed;
91 Boolean locked;
92 Boolean isRoot;
93
94 } SCPreferencesPrivate, *SCPreferencesPrivateRef;
95
96
97 /* Define signature data */
98 typedef struct {
99 dev_t st_dev; /* inode's device */
100 ino_t st_ino; /* inode's number */
101 struct timespec st_mtimespec; /* time of last data modification */
102 off_t st_size; /* file size, in bytes */
103 } SCPSignatureData, *SCPSignatureDataRef;
104
105
106 __BEGIN_DECLS
107
108 SCPreferencesRef
109 __SCPreferencesCreate (CFAllocatorRef allocator,
110 CFStringRef name,
111 CFStringRef prefsID,
112 Boolean perUser,
113 CFStringRef user);
114
115 Boolean
116 __SCPreferencesAccess (SCPreferencesRef prefs);
117
118 Boolean
119 __SCPreferencesAddSession (SCPreferencesRef prefs);
120
121 CFDataRef
122 __SCPSignatureFromStatbuf (const struct stat *statBuf);
123
124 char *
125 __SCPreferencesPath (CFAllocatorRef allocator,
126 CFStringRef prefsID,
127 Boolean perUser,
128 CFStringRef user,
129 Boolean useNewPrefs);
130
131 CFStringRef
132 _SCPNotificationKey (CFAllocatorRef allocator,
133 CFStringRef prefsID,
134 Boolean perUser,
135 CFStringRef user,
136 int keyType);
137
138 __END_DECLS
139
140 #endif /* _SCPREFERENCESINTERNAL_H */