]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCDynamicStoreInternal.h
configd-293.4.tar.gz
[apple/configd.git] / SystemConfiguration.fproj / SCDynamicStoreInternal.h
1 /*
2 * Copyright (c) 2000-2004, 2006, 2009 Apple Computer, 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 #if !TARGET_OS_IPHONE
31 #include <dispatch/dispatch.h>
32 #endif // !TARGET_OS_IPHONE
33 #include <sys/types.h>
34 #include <mach/mach.h>
35 #include <pthread.h>
36 #include <regex.h>
37 #include <CoreFoundation/CoreFoundation.h>
38 #include <CoreFoundation/CFRuntime.h>
39 #include <SystemConfiguration/SCDynamicStore.h>
40
41
42 /* Define the status of any registered notification. */
43 typedef enum {
44 NotifierNotRegistered = 0,
45 Using_NotifierWait,
46 Using_NotifierInformViaCallback,
47 Using_NotifierInformViaMachPort,
48 Using_NotifierInformViaFD,
49 Using_NotifierInformViaSignal,
50 Using_NotifierInformViaRunLoop,
51 Using_NotifierInformViaDispatch
52 } __SCDynamicStoreNotificationStatus;
53
54
55 typedef struct {
56
57 /* base CFType information */
58 CFRuntimeBase cfBase;
59
60 /* server side of the "configd" session */
61 mach_port_t server;
62
63 /* per-session flags */
64 Boolean locked;
65 Boolean useSessionKeys;
66
67 /* current status of notification requests */
68 __SCDynamicStoreNotificationStatus notifyStatus;
69
70 /* "client" information associated with SCDynamicStoreCreateRunLoopSource() */
71 CFIndex rlsRefs;
72 CFRunLoopSourceRef rls;
73 SCDynamicStoreCallBack rlsFunction;
74 SCDynamicStoreContext rlsContext;
75
76 /* "client" information associated with SCDynamicStoreNotifyCallback() */
77 SCDynamicStoreCallBack_v1 callbackFunction;
78 void *callbackArgument;
79 CFMachPortRef callbackPort;
80 CFRunLoopSourceRef callbackRLS;
81
82 #if !TARGET_OS_IPHONE
83 /* "client" information associated with SCDynamicStoreSetDispatchQueue() */
84 dispatch_queue_t dispatchQueue;
85 dispatch_source_t callbackSource;
86 dispatch_queue_t callbackQueue;
87 #endif // !TARGET_OS_IPHONE
88
89 /* "server" SCDynamicStoreKeys being watched */
90 CFMutableSetRef keys;
91 CFMutableSetRef patterns;
92
93 /* "server" information associated with SCDynamicStoreNotifyMachPort() */
94 mach_port_t notifyPort;
95 mach_msg_id_t notifyPortIdentifier;
96
97 /* "server" information associated with SCDynamicStoreNotifyFileDescriptor() */
98 int notifyFile;
99 int notifyFileIdentifier;
100
101 /* "server" information associated with SCDynamicStoreNotifySignal() */
102 int notifySignal;
103 task_t notifySignalTask;
104
105 } SCDynamicStorePrivate, *SCDynamicStorePrivateRef;
106
107
108 __BEGIN_DECLS
109
110 SCDynamicStorePrivateRef
111 __SCDynamicStoreCreatePrivate (CFAllocatorRef allocator,
112 const CFStringRef name,
113 SCDynamicStoreCallBack callout,
114 SCDynamicStoreContext *context);
115
116 __END_DECLS
117
118 #endif /* _SCDYNAMICSTOREINTERNAL_H */