2 * Copyright (c) 2000-2004, 2006, 2009-2011, 2013, 2015, 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 _SCDYNAMICSTOREINTERNAL_H
25 #define _SCDYNAMICSTOREINTERNAL_H
27 #include <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>
35 #include <os/activity.h>
37 #include <CoreFoundation/CoreFoundation.h>
38 #include <CoreFoundation/CFRuntime.h>
41 #define SC_LOG_HANDLE __log_SCDynamicStore()
42 #endif // SC_LOG_HANDLE
43 #include <SystemConfiguration/SystemConfiguration.h>
44 #include <SystemConfiguration/SCPrivate.h>
45 #include <SystemConfiguration/SCValidation.h>
48 /* Define the status of any registered notification. */
50 NotifierNotRegistered
= 0,
52 Using_NotifierInformViaMachPort
,
53 Using_NotifierInformViaFD
,
54 Using_NotifierInformViaSignal
,
55 Using_NotifierInformViaRunLoop
,
56 Using_NotifierInformViaDispatch
57 } __SCDynamicStoreNotificationStatus
;
62 /* base CFType information */
65 /* client side of the "configd" session */
67 CFDictionaryRef options
;
69 /* activity tracing */
70 os_activity_t activity
;
72 /* server side of the "configd" session */
74 Boolean serverNullSession
;
76 /* per-session flags */
77 Boolean useSessionKeys
;
79 /* current status of notification requests */
80 __SCDynamicStoreNotificationStatus notifyStatus
;
82 /* "client" information associated with SCDynamicStoreCreateRunLoopSource() */
83 CFMutableArrayRef rlList
;
84 CFRunLoopSourceRef rls
;
85 SCDynamicStoreCallBack rlsFunction
;
86 SCDynamicStoreContext rlsContext
;
87 CFMachPortRef rlsNotifyPort
;
88 CFRunLoopSourceRef rlsNotifyRLS
;
90 /* "client" information associated with SCDynamicStoreSetDispatchQueue() */
91 dispatch_group_t dispatchGroup
;
92 dispatch_queue_t dispatchQueue
;
93 dispatch_source_t dispatchSource
;
95 /* "client" information associated with SCDynamicStoreSetDisconnectCallBack() */
96 SCDynamicStoreDisconnectCallBack disconnectFunction
;
97 Boolean disconnectForceCallBack
;
99 /* SCDynamicStoreKeys being watched */
100 CFMutableArrayRef keys
;
101 CFMutableArrayRef patterns
;
103 /* "server" information associated with mach port based notifications */
104 mach_port_t notifyPort
;
105 mach_msg_id_t notifyPortIdentifier
;
107 /* "server" information associated with SCDynamicStoreNotifyFileDescriptor() */
109 int notifyFileIdentifier
;
111 /* "server" information associated with SCDynamicStoreNotifySignal() */
113 task_t notifySignalTask
;
115 } SCDynamicStorePrivate
, *SCDynamicStorePrivateRef
;
121 __log_SCDynamicStore ();
123 SCDynamicStorePrivateRef
124 __SCDynamicStoreCreatePrivate (CFAllocatorRef allocator
,
125 const CFStringRef name
,
126 SCDynamicStoreCallBack callout
,
127 SCDynamicStoreContext
*context
);
130 __SCDynamicStoreNullSession (void);
133 __SCDynamicStoreCheckRetryAndHandleError(SCDynamicStoreRef store
,
134 kern_return_t status
,
139 __SCDynamicStoreReconnectNotifications (SCDynamicStoreRef store
);
143 #endif /* _SCDYNAMICSTOREINTERNAL_H */