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