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