]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCPreferencesPath.h
configd-42.tar.gz
[apple/configd.git] / SystemConfiguration.fproj / SCPreferencesPath.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 _SCPREFERENCESPATH_H
24 #define _SCPREFERENCESPATH_H
25
26 #include <sys/cdefs.h>
27 #include <CoreFoundation/CoreFoundation.h>
28 #include <SystemConfiguration/SCPreferences.h>
29
30
31 /*!
32 @header SCPreferencesPath
33 The SCPreferencesPathXXX() APIs allow an application to
34 load and store XML configuration data in a controlled
35 manner and provide the necessary notifications to other
36 applications that need to be aware of configuration
37 changes.
38
39 The SCPreferencesPathXXX() APIs make certain assumptions
40 about the layout of the preferences data. These APIs view
41 the data as a collection of dictionaries of key/value pairs
42 and an associated path name. The root path ("/") identifies
43 the top-level dictionary. Additional path components
44 specify the keys for sub-dictionaries.
45
46 For example, the following dictionary can be accessed via
47 two paths. The root ("/") path would return a dictionary
48 with all keys and values. The path "/path1" would only
49 return the dictionary with the "key3" and "key4" properties.
50
51 <PRE>
52 <BR> &lt;dict&gt;
53 <BR> &lt;key&gt;key1&lt;/key&gt;
54 <BR> &lt;string&gt;val1&lt;/string&gt;
55 <BR> &lt;key&gt;key2&lt;/key&gt;
56 <BR> &lt;string&gt;val2&lt;/string&gt;
57 <BR> &lt;key&gt;path1&lt;/key&gt;
58 <BR> &lt;dict&gt;
59 <BR> &lt;key&gt;key3&lt;/key&gt;
60 <BR> &lt;string&gt;val3&lt;/string&gt;
61 <BR> &lt;key&gt;key4&lt;/key&gt;
62 <BR> &lt;string&gt;val4&lt;/string&gt;
63 <BR> &lt;/dict&gt;
64 <BR> &lt;/dict&gt;
65 </PRE>
66
67 Each dictionary can also include the kSCResvLink key. The
68 value associated with this key is interpreted as a "link" to
69 another path. If this key is present, a call to the
70 SCPreferencesPathGetValue() API will return the dictionary
71 specified by the link.
72
73 The APIs provided by this framework communicate with the "configd"
74 daemon for any tasks requiring synchronization and/or notification.
75 */
76
77
78 __BEGIN_DECLS
79
80 /*!
81 @function SCPreferencesPathCreateUniqueChild
82 @discussion Creates a new path component within the dictionary
83 hierarchy.
84 @param session The SCPreferencesRef handle that should be used to
85 communicate with the APIs.
86 @param prefix A string that represents the parent path.
87 @param newPath A pointer to memory that will be filled with a
88 string representing the new child path.
89 @result A string representing the new (unique) child path; NULL
90 if the specified path does not exist.
91 */
92 CFStringRef
93 SCPreferencesPathCreateUniqueChild (
94 SCPreferencesRef session,
95 CFStringRef prefix
96 );
97
98 /*!
99 @function SCPreferencesPathGetValue
100 @discussion Returns the dictionary associated with the specified
101 path.
102 @param session The SCPreferencesRef handle that should be used to
103 communicate with the APIs.
104 @param path A string that represents the path to be returned.
105 @result The dictionary associated with the specified path; NULL
106 if the path does not exist.
107 */
108 CFDictionaryRef
109 SCPreferencesPathGetValue (
110 SCPreferencesRef session,
111 CFStringRef path
112 );
113
114 /*!
115 @function SCPreferencesPathGetLink
116 @discussion Returns the link (if one exists) associated with the
117 specified path.
118 @param session The SCPreferencesRef handle that should be used to
119 communicate with the APIs.
120 @param path A string that represents the path to be returned.
121 @result The dictionary associated with the specified path; NULL
122 if the path is not a link or does not exist.
123 */
124 CFStringRef
125 SCPreferencesPathGetLink (
126 SCPreferencesRef session,
127 CFStringRef path
128 );
129
130 /*!
131 @function SCPreferencesPathSetValue
132 @discussion Associates a dictionary with the specified path.
133 @param session The SCPreferencesRef handle that should be used to
134 communicate with the APIs.
135 @param path A string that represents the path to be updated.
136 @param value A dictionary that represents the data to be
137 stored at the specified path.
138 @result A boolean indicating the success (or failure) of the call.
139 */
140 Boolean
141 SCPreferencesPathSetValue (
142 SCPreferencesRef session,
143 CFStringRef path,
144 CFDictionaryRef value
145 );
146
147 /*!
148 @function SCPreferencesPathSetLink
149 @discussion Associates a link to a second dictionary at the
150 specified path.
151 @param session The SCPreferencesRef handle that should be used to
152 communicate with the APIs.
153 @param path A string that represents the path to be updated.
154 @param link A string that represents the link to be stored
155 at the specified path.
156 @result A boolean indicating the success (or failure) of the call.
157 */
158 Boolean
159 SCPreferencesPathSetLink (
160 SCPreferencesRef session,
161 CFStringRef path,
162 CFStringRef link
163 );
164
165 /*!
166 @function SCPreferencesPathRemoveValue
167 @discussion Removes the data associated with the specified path.
168 @param session The SCPreferencesRef handle that should be used to
169 communicate with the APIs.
170 @param path A string that represents the path to be returned.
171 @result A boolean indicating the success (or failure) of the call.
172 */
173 Boolean
174 SCPreferencesPathRemoveValue (
175 SCPreferencesRef session,
176 CFStringRef path
177 );
178
179 __END_DECLS
180
181 #endif /* _SCPREFERENCESPATH_H */