1/*
2 * Copyright (c) 2000, 2001, 2003, 2004, 2006, 2009, 2011 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/*
25 * Modification History
26 *
27 * June 1, 2001			Allan Nathanson <ajn@apple.com>
28 * - public API conversion
29 *
30 * June 2, 2000			Allan Nathanson <ajn@apple.com>
31 * - initial revision
32 */
33
34
35#ifndef _S_SCD_H
36#define _S_SCD_H
37
38#include <sys/cdefs.h>
39
40
41/*
42 * keys in the "storeData" dictionary
43 */
44
45/*
46 * data associated with a key
47 */
48#define	kSCDData	CFSTR("data")
49/*
50 * client session ids watching a key and, since we can possibly have
51 * multiple regex keys which reference the key, a count of active
52 * references
53 */
54#define	kSCDWatchers	CFSTR("watchers")
55#define	kSCDWatcherRefs	CFSTR("watcherRefs")
56/*
57 * client session id for per-session keys.
58 */
59#define	kSCDSession	CFSTR("session")
60
61
62/*
63 * keys in the "sessionData" dictionary
64 */
65
66/*
67 * the name of the calling application / plug-in
68 */
69#define	kSCDName	CFSTR("name")
70/*
71 * keys which have changed since last call to SCDNotifierGetChanges()
72 */
73#define	kSCDChangedKeys	CFSTR("changedKeys")
74/*
75 * keys which are to be removed when the session is closed
76 */
77#define	kSCDSessionKeys	CFSTR("sessionKeys")
78
79
80extern CFMutableDictionaryRef	storeData;
81extern CFMutableDictionaryRef	sessionData;
82extern CFMutableDictionaryRef	patternData;
83extern CFMutableSetRef		changedKeys;
84extern CFMutableSetRef		deferredRemovals;
85extern CFMutableSetRef		removedSessionKeys;
86extern CFMutableSetRef		needsNotification;
87
88
89__BEGIN_DECLS
90
91int
92__SCDynamicStoreOpen			(SCDynamicStoreRef	*store,
93					 CFStringRef		name);
94int
95__SCDynamicStoreClose			(SCDynamicStoreRef	*store);
96
97int
98__SCDynamicStorePush			(void);
99
100int
101__SCDynamicStoreCopyKeyList		(SCDynamicStoreRef	store,
102					 CFStringRef		prefix,
103					 Boolean		isRegex,
104					 CFArrayRef		*subKeys);
105
106int
107__SCDynamicStoreAddValue		(SCDynamicStoreRef	store,
108					 CFStringRef		key,
109					 CFDataRef		value);
110
111int
112__SCDynamicStoreCopyValue		(SCDynamicStoreRef	store,
113					 CFStringRef		key,
114					 CFDataRef		*value,
115					 Boolean		internal);
116
117int
118__SCDynamicStoreCopyMultiple		(SCDynamicStoreRef	store,
119					 CFArrayRef		keys,
120					 CFArrayRef		patterns,
121					 CFDictionaryRef	*values);
122
123int
124__SCDynamicStoreSetValue		(SCDynamicStoreRef	store,
125					 CFStringRef		key,
126					 CFDataRef		value,
127					 Boolean		internal);
128
129int
130__SCDynamicStoreSetMultiple		(SCDynamicStoreRef	store,
131					 CFDictionaryRef	keysToSet,
132					 CFArrayRef		keysToRemove,
133					 CFArrayRef		keysToNotify);
134
135int
136__SCDynamicStoreRemoveValue		(SCDynamicStoreRef	store,
137					 CFStringRef		key,
138					 Boolean		internal);
139
140int
141__SCDynamicStoreNotifyValue		(SCDynamicStoreRef	store,
142					 CFStringRef		key,
143					 Boolean		internal);
144
145int
146__SCDynamicStoreSnapshot		(SCDynamicStoreRef	store);
147
148int
149__SCDynamicStoreAddWatchedKey		(SCDynamicStoreRef	store,
150					 CFStringRef		key,
151					 Boolean		isRegex,
152					 Boolean		internal);
153
154int
155__SCDynamicStoreRemoveWatchedKey	(SCDynamicStoreRef	store,
156					 CFStringRef		key,
157					 Boolean		isRegex,
158					 Boolean		internal);
159
160int
161__SCDynamicStoreSetNotificationKeys	(SCDynamicStoreRef	store,
162					 CFArrayRef		keys,
163					 CFArrayRef		patterns);
164
165int
166__SCDynamicStoreCopyNotifiedKeys	(SCDynamicStoreRef	store,
167					 CFArrayRef		*notifierKeys);
168
169int
170__SCDynamicStoreNotifyMachPort		(SCDynamicStoreRef	store,
171					 mach_msg_id_t		msgid,
172					 mach_port_t		port);
173
174int
175__SCDynamicStoreNotifyFileDescriptor	(SCDynamicStoreRef	store,
176					 int32_t		identifier,
177					 int			*fd);
178
179int
180__SCDynamicStoreNotifySignal		(SCDynamicStoreRef	store,
181					 pid_t			pid,
182					 int			sig);
183
184int
185__SCDynamicStoreNotifyCancel		(SCDynamicStoreRef	store);
186
187void
188_addWatcher				(CFNumberRef		sessionNum,
189					 CFStringRef		watchedKey);
190
191void
192_removeWatcher				(CFNumberRef		sessionNum,
193					 CFStringRef		watchedKey);
194
195void
196pushNotifications			(FILE			*_configd_trace);
197
198__END_DECLS
199
200#endif /* !_S_SCD_H */
201