2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
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
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.
23 * @APPLE_LICENSE_HEADER_END@
29 #include <sys/cdefs.h>
31 #include <CoreFoundation/CoreFoundation.h>
33 #include <SystemConfiguration/SCDynamicStorePrivate.h>
34 #include <SystemConfiguration/SCDynamicStoreCopySpecificPrivate.h>
35 #include <SystemConfiguration/SCDynamicStoreSetSpecificPrivate.h>
37 #include <SystemConfiguration/SCPreferencesPrivate.h>
39 /* framework variables */
40 extern Boolean _sc_debug
; /* TRUE if debugging enabled */
41 extern Boolean _sc_verbose
; /* TRUE if verbose logging enabled */
42 extern Boolean _sc_log
; /* TRUE if SCLog() output goes to syslog */
48 @discussion Returns a last SystemConfiguration.framework API error code.
49 @result The last error encountered.
51 void _SCErrorSet (int error
);
54 @function _SCSerialize
55 @discussion Serialize a CFPropertyList object for passing
57 @param obj CFPropertyList object to serialize
58 @param xml A pointer to a CFDataRef, NULL if data should be
60 @param data A pointer to the newly allocated/serialized data
61 @param dataLen A pointer to the length in bytes of the newly
62 allocated/serialized data
64 Boolean
_SCSerialize (CFPropertyListRef obj
,
70 @function _SCUnserialize
71 @discussion Unserialize a stream of bytes passed from/to configd
72 into a CFPropertyList object.
73 @param obj A pointer to memory that will be filled with the CFPropertyList
74 associated with the stream of bytes.
75 @param xml CFDataRef with the serialized data
76 @param data A pointer to the serialized data
77 @param dataLen A pointer to the length of the serialized data
79 Specify either "xml" or "data/dataLen".
81 Boolean
_SCUnserialize (CFPropertyListRef
*obj
,
87 @function _SCSerializeString
88 @discussion Serialize a CFString object for passing
90 @param str CFString key to serialize
91 @param data A pointer to a CFDataRef, NULL if storage should be
93 @param data A pointer to the newly allocated/serialized data
94 @param dataLen A pointer to the length in bytes of the newly
95 allocated/serialized data
97 Boolean
_SCSerializeString (CFStringRef str
,
103 @function _SCUnserializeString
104 @discussion Unserialize a stream of bytes passed from/to configd
105 into a CFString object.
106 @param str A pointer to memory that will be filled with the CFPropertyList
107 associated with the stream of bytes.
108 @param utf8 CFDataRef with the serialized data
109 @param data A pointer to the serialized data
110 @param dataLen A pointer to the length of the serialized data
112 Specify either "utf8" or "data/dataLen".
114 Boolean
_SCUnserializeString (CFStringRef
*str
,
120 @function _SCSerializeData
121 @discussion Serialize a CFData object for passing
123 @param data CFData key to serialize
124 @param data A pointer to the newly allocated/serialized data
125 @param dataLen A pointer to the length in bytes of the newly
126 allocated/serialized data
128 Boolean
_SCSerializeData (CFDataRef data
,
133 @function _SCUnserializeData
134 @discussion Unserialize a stream of bytes passed from/to configd
135 into a CFData object.
136 @param data A pointer to memory that will be filled with the CFPropertyList
137 associated with the stream of bytes.
138 @param data A pointer to the serialized data
139 @param dataLen A pointer to the length of the serialized data
141 Boolean
_SCUnserializeData (CFDataRef
*data
,
146 @function _SCSerializeMultiple
147 @discussion Convert a CFDictionary containing a set of CFPropertlyList
148 values into a CFDictionary containing a set of serialized CFData
150 @param dict The CFDictionary with CFPropertyList values.
151 @result The serialized CFDictionary with CFData values
153 CFDictionaryRef
_SCSerializeMultiple (CFDictionaryRef dict
);
156 @function _SCUnserializeMultiple
157 @discussion Convert a CFDictionary containing a set of CFData
158 values into a CFDictionary containing a set of serialized
159 CFPropertlyList values.
160 @param dict The CFDictionary with CFData values.
161 @result The serialized CFDictionary with CFPropertyList values
163 CFDictionaryRef
_SCUnserializeMultiple (CFDictionaryRef dict
);
166 @function _SC_cfstring_to_cstring
167 @discussion Extracts a C-string from a CFString.
168 @param cfstr The CFString to extract the data from.
169 @param buf A user provided buffer of the specefied length. If NULL,
170 a new buffer will be allocated to contain the C-string. It
171 is the responsiblity of the caller to free an allocated
173 @param bufLen The size of the user provided buffer.
174 @param encoding The string encoding
175 @result If the extraction (conversion) is successful then a pointer
176 to the user provided (or allocated) buffer is returned, NULL
177 if the string could not be extracted.
179 char * _SC_cfstring_to_cstring (CFStringRef cfstr
,
182 CFStringEncoding encoding
);
186 @discussion Conditionally issue a log message.
187 @param condition A boolean value indicating if the message should be logged
188 @param level A syslog(3) logging priority.
189 @param formatString The format string
190 @result The specified message will be written to the system message
191 logger (See syslogd(8)).
193 void SCLog (Boolean condition
,
195 CFStringRef formatString
,
200 @discussion Conditionally issue a debug message.
201 @param condition A boolean value indicating if the message should be written
202 @param stream The output stream for the log message.
203 @param formatString The format string
204 @result The message will be written to the specified stream
207 void SCPrint (Boolean condition
,
209 CFStringRef formatString
,
214 @discussion Conditionally issue a debug message with a time stamp.
215 @param condition A boolean value indicating if the message should be written
216 @param stream The output stream for the log message.
217 @param formatString The format string
218 @result The message will be written to the specified stream
221 void SCTrace (Boolean condition
,
223 CFStringRef formatString
,
228 #endif /* _SCPRIVATE_H */