]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCDynamicStoreInternal.h
configd-1109.101.1.tar.gz
[apple/configd.git] / SystemConfiguration.fproj / SCDynamicStoreInternal.h
1 /*
2 * Copyright (c) 2000-2004, 2006, 2009-2011, 2013, 2015-2019 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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
11 * file.
12 *
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.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifndef _SCDYNAMICSTOREINTERNAL_H
25 #define _SCDYNAMICSTOREINTERNAL_H
26
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>
33 #include <pthread.h>
34 #include <regex.h>
35 #include <os/log.h>
36 #include <CoreFoundation/CoreFoundation.h>
37 #include <CoreFoundation/CFRuntime.h>
38
39 #ifndef SC_LOG_HANDLE
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>
45
46
47 /* Define the status of any registered notification. */
48 typedef enum {
49 NotifierNotRegistered = 0,
50 Using_NotifierWait,
51 Using_NotifierInformViaMachPort,
52 Using_NotifierInformViaFD,
53 Using_NotifierInformViaRunLoop,
54 Using_NotifierInformViaDispatch
55 } __SCDynamicStoreNotificationStatus;
56
57
58 typedef struct {
59
60 /* base CFType information */
61 CFRuntimeBase cfBase;
62
63 /* client side of the "configd" session */
64 CFStringRef name;
65 CFDictionaryRef options;
66
67 /* server side of the "configd" session */
68 mach_port_t server;
69 Boolean serverNullSession;
70
71 /* per-session flags */
72 Boolean useSessionKeys;
73
74 /* current status of notification requests */
75 __SCDynamicStoreNotificationStatus notifyStatus;
76
77 /* "client" information associated with SCDynamicStoreCreateRunLoopSource() */
78 CFMutableArrayRef rlList;
79 CFRunLoopSourceRef rls;
80 SCDynamicStoreCallBack rlsFunction;
81 SCDynamicStoreContext rlsContext;
82 CFMachPortRef rlsNotifyPort;
83 CFRunLoopSourceRef rlsNotifyRLS;
84
85 /* "client" information associated with SCDynamicStoreSetDispatchQueue() */
86 dispatch_group_t dispatchGroup;
87 dispatch_queue_t dispatchQueue;
88 dispatch_source_t dispatchSource;
89
90 /* "client" information associated with SCDynamicStoreSetDisconnectCallBack() */
91 SCDynamicStoreDisconnectCallBack disconnectFunction;
92 Boolean disconnectForceCallBack;
93
94 /* SCDynamicStoreKeys being watched */
95 CFMutableArrayRef keys;
96 CFMutableArrayRef patterns;
97
98 /* "server" information associated with mach port based notifications */
99 mach_port_t notifyPort;
100 mach_msg_id_t notifyPortIdentifier;
101
102 /* "server" information associated with SCDynamicStoreNotifyFileDescriptor() */
103 int notifyFile;
104 int notifyFileIdentifier;
105
106 /* caching */
107 Boolean cache_active;
108 CFMutableDictionaryRef cached_keys;
109 CFMutableDictionaryRef cached_set;
110 CFMutableArrayRef cached_removals;
111 CFMutableArrayRef cached_notifys;
112
113 } SCDynamicStorePrivate, *SCDynamicStorePrivateRef;
114
115
116 __BEGIN_DECLS
117
118 __private_extern__
119 os_log_t
120 __log_SCDynamicStore (void);
121
122 SCDynamicStorePrivateRef
123 __SCDynamicStoreCreatePrivate (CFAllocatorRef allocator,
124 const CFStringRef name,
125 SCDynamicStoreCallBack callout,
126 SCDynamicStoreContext *context);
127
128 __private_extern__
129 SCDynamicStoreRef
130 __SCDynamicStoreNullSession (void);
131
132 __private_extern__
133 Boolean
134 __SCDynamicStoreCheckRetryAndHandleError(SCDynamicStoreRef store,
135 kern_return_t status,
136 int *sc_status,
137 const char *func);
138
139 __private_extern__
140 Boolean
141 __SCDynamicStoreReconnectNotifications (SCDynamicStoreRef store);
142
143 __END_DECLS
144
145 #endif /* _SCDYNAMICSTOREINTERNAL_H */