]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCPreferencesInternal.h
fb95d008c6703d3ac76bd70fb97748310f3d6f2e
[apple/configd.git] / SystemConfiguration.fproj / SCPreferencesInternal.h
1 /*
2 * Copyright (c) 2000, 2001, 2003-2005, 2007 Apple 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 /* configuration file */
61 char *path;
62 char *newPath;
63
64 /* preferences lock, lock file */
65 Boolean locked;
66 int lockFD;
67 char *lockPath;
68
69 /* configuration file signature */
70 CFDataRef signature;
71
72 /* configd session */
73 SCDynamicStoreRef session;
74
75 /* configd session keys */
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 isRoot;
92
93 /* authorization, helper */
94 CFDataRef authorizationData;
95 int helper;
96
97 } SCPreferencesPrivate, *SCPreferencesPrivateRef;
98
99
100 /* Define signature data */
101 typedef struct {
102 dev_t st_dev; /* inode's device */
103 ino_t st_ino; /* inode's number */
104 struct timespec st_mtimespec; /* time of last data modification */
105 off_t st_size; /* file size, in bytes */
106 } SCPSignatureData, *SCPSignatureDataRef;
107
108
109 __BEGIN_DECLS
110
111 Boolean
112 __SCPreferencesCreate_helper (SCPreferencesRef prefs);
113
114 void
115 __SCPreferencesAccess (SCPreferencesRef prefs);
116
117 Boolean
118 __SCPreferencesAddSession (SCPreferencesRef prefs);
119
120 CFDataRef
121 __SCPSignatureFromStatbuf (const struct stat *statBuf);
122
123 char *
124 __SCPreferencesPath (CFAllocatorRef allocator,
125 CFStringRef prefsID,
126 Boolean useNewPrefs);
127
128 CFStringRef
129 _SCPNotificationKey (CFAllocatorRef allocator,
130 CFStringRef prefsID,
131 int keyType);
132
133 __END_DECLS
134
135 #endif /* _SCPREFERENCESINTERNAL_H */