2 * Copyright (c) 2000, 2001, 2003-2005, 2007-2011, 2013-2018 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 <os/state_private.h>
33 #include <CoreFoundation/CoreFoundation.h>
34 #include <CoreFoundation/CFRuntime.h>
37 #define SC_LOG_HANDLE __log_SCPreferences
38 #endif // SC_LOG_HANDLE
39 #include <SystemConfiguration/SystemConfiguration.h>
40 #include <SystemConfiguration/SCValidation.h>
41 #include <SystemConfiguration/SCPrivate.h>
43 #include <SystemConfiguration/SCPreferences.h>
44 #include <SystemConfiguration/SCDynamicStore.h>
47 #define PREFS_DEFAULT_DIR CFSTR("/Library/Preferences/SystemConfiguration")
48 #define PREFS_DEFAULT_CONFIG CFSTR("preferences.plist")
50 #define PREFS_DEFAULT_DIR_OLD CFSTR("/var/db/SystemConfiguration")
51 #define PREFS_DEFAULT_CONFIG_OLD CFSTR("preferences.xml")
53 #define PREFS_DEFAULT_USER_DIR CFSTR("Library/Preferences")
55 #define NETWORK_INTERFACES_PREFS CFSTR("NetworkInterfaces.plist")
56 #define INTERFACES CFSTR("Interfaces")
59 /* Define the per-preference-handle structure */
62 /* base CFType information */
75 CFDictionaryRef options
;
77 /* configuration file */
81 /* preferences lock, lock file */
85 struct timeval lockTime
;
87 /* configuration file signature */
91 SCDynamicStoreRef session
;
92 SCDynamicStoreRef sessionNoO_EXLOCK
;
95 /* configd session keys */
96 CFStringRef sessionKeyLock
;
97 CFStringRef sessionKeyCommit
;
98 CFStringRef sessionKeyApply
;
100 /* run loop source, callout, context, rl scheduling info */
102 CFRunLoopSourceRef rls
;
103 SCPreferencesCallBack rlsFunction
;
104 SCPreferencesContext rlsContext
;
105 CFMutableArrayRef rlList
;
106 dispatch_queue_t dispatchQueue
; // SCPreferencesSetDispatchQueue
109 CFMutableDictionaryRef prefs
;
115 Boolean limit_SCNetworkConfiguration
;
117 /* authorization, helper */
118 CFDataRef authorizationData
;
119 mach_port_t helper_port
;
121 } SCPreferencesPrivate
, *SCPreferencesPrivateRef
;
124 /* Define signature data */
126 int64_t st_dev
; /* inode's device */
127 uint64_t st_ino
; /* inode's number */
128 uint64_t tv_sec
; /* time of last data modification */
130 off_t st_size
; /* file size, in bytes */
131 } SCPSignatureData
, *SCPSignatureDataRef
;
137 __log_SCPreferences (void);
140 __SCPreferencesCreate_helper (SCPreferencesRef prefs
);
143 __SCPreferencesAccess (SCPreferencesRef prefs
);
146 __SCPreferencesAddSessionKeys (SCPreferencesRef prefs
);
149 __SCPreferencesAddSession (SCPreferencesRef prefs
);
152 __SCPreferencesRemoveSession (SCPreferencesRef prefs
);
155 __SCPreferencesUpdateLockedState (SCPreferencesRef prefs
,
160 __SCPSignatureFromStatbuf (const struct stat
*statBuf
);
163 __SCPreferencesPath (CFAllocatorRef allocator
,
165 Boolean useNewPrefs
);
168 __SCPreferencesPrefsSize (SCPreferencesRef prefs
);
172 _SCPNotificationKey (CFAllocatorRef allocator
,
176 __SCPreferencesGetLimitSCNetworkConfiguration (SCPreferencesRef prefs
);
179 __SCPreferencesSetLimitSCNetworkConfiguration
180 (SCPreferencesRef prefs
,
181 Boolean limit_SCNetworkConfiguration
);
184 __SCPreferencesUsingDefaultPrefs (SCPreferencesRef prefs
);
187 __SCPreferencesCreateNIPrefsFromPrefs (SCPreferencesRef prefs
);
191 #endif /* _SCPREFERENCESINTERNAL_H */