]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCDPrivate.h
configd-24.tar.gz
[apple/configd.git] / SystemConfiguration.fproj / SCDPrivate.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23 #ifndef _SCDPRIVATE_H
24 #define _SCDPRIVATE_H
25
26 #include <SystemConfiguration/SCD.h>
27
28 #include <sys/cdefs.h>
29 #include <sys/types.h>
30 #include <regex.h>
31 #include <pthread.h>
32 #include <CoreFoundation/CFMachPort.h>
33
34
35 /* Define the per-session (and global) flags */
36 typedef struct {
37 int debug;
38 int verbose;
39 boolean_t isLocked;
40 boolean_t useSyslog;
41 boolean_t useCFRunLoop;
42 } _SCDFlags;
43
44
45 /* Define the status of any registered notification. */
46 typedef enum {
47 NotifierNotRegistered = 0,
48 Using_NotifierWait,
49 Using_NotifierInformViaCallback,
50 Using_NotifierInformViaMachPort,
51 Using_NotifierInformViaFD,
52 Using_NotifierInformViaSignal,
53 } _SCDNotificationStatus;
54
55
56 typedef struct {
57
58 /* server side of the "configd" session */
59 mach_port_t server;
60
61 /* per-session flags */
62 _SCDFlags flags;
63
64 /* SCDKeys being watched */
65 CFMutableSetRef keys;
66 CFMutableSetRef reKeys;
67
68 /* current status of notification requests */
69 _SCDNotificationStatus notifyStatus;
70
71 /* "client" information associated with SCDNotifierInformViaCallback() */
72 SCDCallbackRoutine_t callbackFunction;
73 void *callbackArgument;
74 CFMachPortRef callbackPort;
75 CFRunLoopSourceRef callbackRunLoopSource; /* XXX CFMachPortInvalidate() doesn't work */
76 pthread_t callbackHelper;
77
78 /* "server" information associated with SCDNotifierInformViaMachPort() */
79 mach_port_t notifyPort;
80 mach_msg_id_t notifyPortIdentifier;
81
82 /* "server" information associated with SCDNotifierInformViaFD() */
83 int notifyFile;
84 int notifyFileIdentifier;
85
86 /* "server" information associated with SCDNotifierInformViaSignal() */
87 int notifySignal;
88 task_t notifySignalTask;
89
90 } SCDSessionPrivate, *SCDSessionPrivateRef;
91
92
93 typedef struct {
94
95 /* configuration data associated with key */
96 CFPropertyListRef data;
97
98 /* instance value of last fetched data */
99 int instance;
100
101 } SCDHandlePrivate, *SCDHandlePrivateRef;
102
103
104 /* per-session options */
105 typedef enum {
106 kSCDOptionIsLocked = 1024,
107 } SCDServerSessionOptions;
108
109
110 /* global options */
111 typedef enum {
112 kSCDOptionIsServer = 2048,
113 } SCDServerGlobalOptions;
114
115
116 __BEGIN_DECLS
117
118 SCDSessionRef _SCDSessionCreatePrivate ();
119
120 void _SCDHandleSetInstance (SCDHandleRef handle,
121 int instance);
122
123 mach_msg_id_t _waitForMachMessage (mach_port_t port);
124
125 void _showMachPortStatus ();
126 void _showMachPortReferences (mach_port_t port);
127
128 __END_DECLS
129
130 #endif /* !_SCDPRIVATE_H */