2 * Copyright (c) 2000, 2001, 2003-2005, 2007-2011, 2013-2016 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
24 #ifndef _SCPREFERENCESINTERNAL_H
25 #define _SCPREFERENCESINTERNAL_H
27 #include <dispatch/dispatch.h>
28 #include <sys/types.h>
32 #include <CoreFoundation/CoreFoundation.h>
33 #include <CoreFoundation/CFRuntime.h>
36 #define SC_LOG_HANDLE __log_SCPreferences()
37 #endif // SC_LOG_HANDLE
38 #include <SystemConfiguration/SystemConfiguration.h>
39 #include <SystemConfiguration/SCValidation.h>
40 #include <SystemConfiguration/SCPrivate.h>
42 #include <SystemConfiguration/SCPreferences.h>
43 #include <SystemConfiguration/SCDynamicStore.h>
46 #define PREFS_DEFAULT_DIR CFSTR("/Library/Preferences/SystemConfiguration")
47 #define PREFS_DEFAULT_CONFIG CFSTR("preferences.plist")
49 #define PREFS_DEFAULT_DIR_OLD CFSTR("/var/db/SystemConfiguration")
50 #define PREFS_DEFAULT_CONFIG_OLD CFSTR("preferences.xml")
52 #define PREFS_DEFAULT_USER_DIR CFSTR("Library/Preferences")
54 #define NETWORK_INTERFACES_PREFS CFSTR("NetworkInterfaces.plist")
55 #define INTERFACES CFSTR("Interfaces")
58 /* Define the per-preference-handle structure */
61 /* base CFType information */
74 CFDictionaryRef options
;
76 /* configuration file */
80 /* preferences lock, lock file */
84 struct timeval lockTime
;
86 /* configuration file signature */
90 SCDynamicStoreRef session
;
91 SCDynamicStoreRef sessionNoO_EXLOCK
;
94 /* configd session keys */
95 CFStringRef sessionKeyLock
;
96 CFStringRef sessionKeyCommit
;
97 CFStringRef sessionKeyApply
;
99 /* run loop source, callout, context, rl scheduling info */
101 CFRunLoopSourceRef rls
;
102 SCPreferencesCallBack rlsFunction
;
103 SCPreferencesContext rlsContext
;
104 CFMutableArrayRef rlList
;
105 dispatch_queue_t dispatchQueue
; // SCPreferencesSetDispatchQueue
108 CFMutableDictionaryRef prefs
;
114 Boolean limit_SCNetworkConfiguration
;
116 /* authorization, helper */
117 CFDataRef authorizationData
;
118 mach_port_t helper_port
;
120 } SCPreferencesPrivate
, *SCPreferencesPrivateRef
;
123 /* Define signature data */
125 int64_t st_dev
; /* inode's device */
126 uint64_t st_ino
; /* inode's number */
127 uint64_t tv_sec
; /* time of last data modification */
129 off_t st_size
; /* file size, in bytes */
130 } SCPSignatureData
, *SCPSignatureDataRef
;
136 __log_SCPreferences ();
139 __SCPreferencesCreate_helper (SCPreferencesRef prefs
);
142 __SCPreferencesAccess (SCPreferencesRef prefs
);
145 __SCPreferencesAddSessionKeys (SCPreferencesRef prefs
);
148 __SCPreferencesAddSession (SCPreferencesRef prefs
);
151 __SCPreferencesRemoveSession (SCPreferencesRef prefs
);
155 __SCPSignatureFromStatbuf (const struct stat
*statBuf
);
158 __SCPreferencesPath (CFAllocatorRef allocator
,
160 Boolean useNewPrefs
);
164 _SCPNotificationKey (CFAllocatorRef allocator
,
168 __SCPreferencesGetLimitSCNetworkConfiguration (SCPreferencesRef prefs
);
171 __SCPreferencesSetLimitSCNetworkConfiguration
172 (SCPreferencesRef prefs
,
173 Boolean limit_SCNetworkConfiguration
);
176 __SCPreferencesUsingDefaultPrefs (SCPreferencesRef prefs
);
179 __SCPreferencesCreateNIPrefsFromPrefs (SCPreferencesRef prefs
);
183 #endif /* _SCPREFERENCESINTERNAL_H */