2 * Copyright (c) 2000, 2001, 2003-2005, 2007-2011, 2013, 2014 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 <sys/types.h>
30 #include <CoreFoundation/CoreFoundation.h>
31 #include <CoreFoundation/CFRuntime.h>
32 #include <SystemConfiguration/SCPreferences.h>
33 #include <SystemConfiguration/SCDynamicStore.h>
34 #include <dispatch/dispatch.h>
37 #define PREFS_DEFAULT_DIR CFSTR("/Library/Preferences/SystemConfiguration")
38 #define PREFS_DEFAULT_CONFIG CFSTR("preferences.plist")
40 #define PREFS_DEFAULT_DIR_OLD CFSTR("/var/db/SystemConfiguration")
41 #define PREFS_DEFAULT_CONFIG_OLD CFSTR("preferences.xml")
43 #define PREFS_DEFAULT_USER_DIR CFSTR("Library/Preferences")
45 #define NETWORK_INTERFACES_PREFS CFSTR("NetworkInterfaces.plist")
46 #define INTERFACES CFSTR("Interfaces")
49 /* Define the per-preference-handle structure */
52 /* base CFType information */
65 CFDictionaryRef options
;
67 /* configuration file */
71 /* preferences lock, lock file */
75 struct timeval lockTime
;
77 /* configuration file signature */
81 SCDynamicStoreRef session
;
83 /* configd session keys */
84 CFStringRef sessionKeyLock
;
85 CFStringRef sessionKeyCommit
;
86 CFStringRef sessionKeyApply
;
88 /* run loop source, callout, context, rl scheduling info */
90 CFRunLoopSourceRef rls
;
91 SCPreferencesCallBack rlsFunction
;
92 SCPreferencesContext rlsContext
;
93 CFMutableArrayRef rlList
;
94 dispatch_queue_t dispatchQueue
; // SCPreferencesSetDispatchQueue
97 CFMutableDictionaryRef prefs
;
103 Boolean limit_SCNetworkConfiguration
;
105 /* authorization, helper */
106 CFDataRef authorizationData
;
107 Boolean authorizationRequired
;
108 mach_port_t helper_port
;
110 } SCPreferencesPrivate
, *SCPreferencesPrivateRef
;
113 /* Define signature data */
115 int64_t st_dev
; /* inode's device */
116 uint64_t st_ino
; /* inode's number */
117 uint64_t tv_sec
; /* time of last data modification */
119 off_t st_size
; /* file size, in bytes */
120 } SCPSignatureData
, *SCPSignatureDataRef
;
126 __SCPreferencesCreate_helper (SCPreferencesRef prefs
);
129 __SCPreferencesAccess (SCPreferencesRef prefs
);
132 __SCPreferencesAddSession (SCPreferencesRef prefs
);
136 __SCPSignatureFromStatbuf (const struct stat
*statBuf
);
139 __SCPreferencesPath (CFAllocatorRef allocator
,
141 Boolean useNewPrefs
);
145 _SCPNotificationKey (CFAllocatorRef allocator
,
149 __SCPreferencesGetLimitSCNetworkConfiguration (SCPreferencesRef prefs
);
152 __SCPreferencesSetLimitSCNetworkConfiguration
153 (SCPreferencesRef prefs
,
154 Boolean limit_SCNetworkConfiguration
);
157 __SCPreferencesUsingDefaultPrefs (SCPreferencesRef prefs
);
160 __SCPreferencesCreateNIPrefsFromPrefs (SCPreferencesRef prefs
);
164 #endif /* _SCPREFERENCESINTERNAL_H */