2 * Copyright (c) 2000-2004, 2006, 2009-2011, 2013, 2015-2019 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 _SCDYNAMICSTOREINTERNAL_H
25 #define _SCDYNAMICSTOREINTERNAL_H
27 #include <os/availability.h>
28 #include <TargetConditionals.h>
29 #include <sys/cdefs.h>
30 #include <dispatch/dispatch.h>
31 #include <sys/types.h>
32 #include <mach/mach.h>
36 #include <CoreFoundation/CoreFoundation.h>
37 #include <CoreFoundation/CFRuntime.h>
40 #define SC_LOG_HANDLE __log_SCDynamicStore
41 #endif // SC_LOG_HANDLE
42 #include <SystemConfiguration/SystemConfiguration.h>
43 #include <SystemConfiguration/SCPrivate.h>
44 #include <SystemConfiguration/SCValidation.h>
47 /* Define the status of any registered notification. */
49 NotifierNotRegistered
= 0,
51 Using_NotifierInformViaMachPort
,
52 Using_NotifierInformViaFD
,
53 Using_NotifierInformViaRunLoop
,
54 Using_NotifierInformViaDispatch
55 } __SCDynamicStoreNotificationStatus
;
60 /* base CFType information */
63 /* client side of the "configd" session */
65 CFDictionaryRef options
;
67 /* server side of the "configd" session */
69 Boolean serverNullSession
;
71 /* per-session flags */
72 Boolean useSessionKeys
;
74 /* current status of notification requests */
75 __SCDynamicStoreNotificationStatus notifyStatus
;
77 /* "client" information associated with SCDynamicStoreCreateRunLoopSource() */
78 CFMutableArrayRef rlList
;
79 CFRunLoopSourceRef rls
;
80 SCDynamicStoreCallBack rlsFunction
;
81 SCDynamicStoreContext rlsContext
;
82 CFMachPortRef rlsNotifyPort
;
83 CFRunLoopSourceRef rlsNotifyRLS
;
85 /* "client" information associated with SCDynamicStoreSetDispatchQueue() */
86 dispatch_group_t dispatchGroup
;
87 dispatch_queue_t dispatchQueue
;
88 dispatch_source_t dispatchSource
;
90 /* "client" information associated with SCDynamicStoreSetDisconnectCallBack() */
91 SCDynamicStoreDisconnectCallBack disconnectFunction
;
92 Boolean disconnectForceCallBack
;
94 /* SCDynamicStoreKeys being watched */
95 CFMutableArrayRef keys
;
96 CFMutableArrayRef patterns
;
98 /* "server" information associated with mach port based notifications */
99 mach_port_t notifyPort
;
100 mach_msg_id_t notifyPortIdentifier
;
102 /* "server" information associated with SCDynamicStoreNotifyFileDescriptor() */
104 int notifyFileIdentifier
;
107 Boolean cache_active
;
108 CFMutableDictionaryRef cached_keys
;
109 CFMutableDictionaryRef cached_set
;
110 CFMutableArrayRef cached_removals
;
111 CFMutableArrayRef cached_notifys
;
113 } SCDynamicStorePrivate
, *SCDynamicStorePrivateRef
;
120 __log_SCDynamicStore (void);
122 SCDynamicStorePrivateRef
123 __SCDynamicStoreCreatePrivate (CFAllocatorRef allocator
,
124 const CFStringRef name
,
125 SCDynamicStoreCallBack callout
,
126 SCDynamicStoreContext
*context
);
130 __SCDynamicStoreNullSession (void);
134 __SCDynamicStoreCheckRetryAndHandleError(SCDynamicStoreRef store
,
135 kern_return_t status
,
141 __SCDynamicStoreReconnectNotifications (SCDynamicStoreRef store
);
145 #endif /* _SCDYNAMICSTOREINTERNAL_H */