]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCPreferencesPath.h
98cd637d14e8e81c328d003acbc38e79d0a21771
[apple/configd.git] / SystemConfiguration.fproj / SCPreferencesPath.h
1 /*
2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25
26 #ifndef _SCPREFERENCESPATH_H
27 #define _SCPREFERENCESPATH_H
28
29 #include <sys/cdefs.h>
30 #include <CoreFoundation/CoreFoundation.h>
31 #include <SystemConfiguration/SCPreferences.h>
32
33
34 /*!
35 @header SCPreferencesPath
36 The SCPreferencesPathXXX() APIs allow an application to
37 load and store XML configuration data in a controlled
38 manner and provide the necessary notifications to other
39 applications that need to be aware of configuration
40 changes.
41
42 The SCPreferencesPathXXX() APIs make certain assumptions
43 about the layout of the preferences data. These APIs view
44 the data as a collection of dictionaries of key/value pairs
45 and an associated path name. The root path ("/") identifies
46 the top-level dictionary. Additional path components
47 specify the keys for sub-dictionaries.
48
49 For example, the following dictionary can be accessed via
50 two paths. The root ("/") path would return a dictionary
51 with all keys and values. The path "/path1" would only
52 return the dictionary with the "key3" and "key4" properties.
53
54 <PRE>
55 <BR> &lt;dict&gt;
56 <BR> &lt;key&gt;key1&lt;/key&gt;
57 <BR> &lt;string&gt;val1&lt;/string&gt;
58 <BR> &lt;key&gt;key2&lt;/key&gt;
59 <BR> &lt;string&gt;val2&lt;/string&gt;
60 <BR> &lt;key&gt;path1&lt;/key&gt;
61 <BR> &lt;dict&gt;
62 <BR> &lt;key&gt;key3&lt;/key&gt;
63 <BR> &lt;string&gt;val3&lt;/string&gt;
64 <BR> &lt;key&gt;key4&lt;/key&gt;
65 <BR> &lt;string&gt;val4&lt;/string&gt;
66 <BR> &lt;/dict&gt;
67 <BR> &lt;/dict&gt;
68 </PRE>
69
70 Each dictionary can also include the kSCResvLink key. The
71 value associated with this key is interpreted as a "link" to
72 another path. If this key is present, a call to the
73 SCPreferencesPathGetValue() API will return the dictionary
74 specified by the link.
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 @result A string representing the new (unique) child path; NULL
88 if the specified path does not exist.
89 */
90 CFStringRef
91 SCPreferencesPathCreateUniqueChild (
92 SCPreferencesRef session,
93 CFStringRef prefix
94 );
95
96 /*!
97 @function SCPreferencesPathGetValue
98 @discussion Returns the dictionary associated with the specified
99 path.
100 @param session The SCPreferencesRef handle that should be used to
101 communicate with the APIs.
102 @param path A string that represents the path to be returned.
103 @result The dictionary associated with the specified path; NULL
104 if the path does not exist.
105 */
106 CFDictionaryRef
107 SCPreferencesPathGetValue (
108 SCPreferencesRef session,
109 CFStringRef path
110 );
111
112 /*!
113 @function SCPreferencesPathGetLink
114 @discussion Returns the link (if one exists) associated with the
115 specified path.
116 @param session The SCPreferencesRef handle that should be used to
117 communicate with the APIs.
118 @param path A string that represents the path to be returned.
119 @result The dictionary associated with the specified path; NULL
120 if the path is not a link or does not exist.
121 */
122 CFStringRef
123 SCPreferencesPathGetLink (
124 SCPreferencesRef session,
125 CFStringRef path
126 );
127
128 /*!
129 @function SCPreferencesPathSetValue
130 @discussion Associates a dictionary with the specified path.
131 @param session The SCPreferencesRef handle that should be used to
132 communicate with the APIs.
133 @param path A string that represents the path to be updated.
134 @param value A dictionary that represents the data to be
135 stored at the specified path.
136 @result A boolean indicating the success (or failure) of the call.
137 */
138 Boolean
139 SCPreferencesPathSetValue (
140 SCPreferencesRef session,
141 CFStringRef path,
142 CFDictionaryRef value
143 );
144
145 /*!
146 @function SCPreferencesPathSetLink
147 @discussion Associates a link to a second dictionary at the
148 specified path.
149 @param session The SCPreferencesRef handle that should be used to
150 communicate with the APIs.
151 @param path A string that represents the path to be updated.
152 @param link A string that represents the link to be stored
153 at the specified path.
154 @result A boolean indicating the success (or failure) of the call.
155 */
156 Boolean
157 SCPreferencesPathSetLink (
158 SCPreferencesRef session,
159 CFStringRef path,
160 CFStringRef link
161 );
162
163 /*!
164 @function SCPreferencesPathRemoveValue
165 @discussion Removes the data associated with the specified path.
166 @param session The SCPreferencesRef handle that should be used to
167 communicate with the APIs.
168 @param path A string that represents the path to be returned.
169 @result A boolean indicating the success (or failure) of the call.
170 */
171 Boolean
172 SCPreferencesPathRemoveValue (
173 SCPreferencesRef session,
174 CFStringRef path
175 );
176
177 __END_DECLS
178
179 #endif /* _SCPREFERENCESPATH_H */