2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
27 #include <sys/cdefs.h>
29 #include <CoreFoundation/CoreFoundation.h>
31 #include <SystemConfiguration/SCDynamicStorePrivate.h>
32 #include <SystemConfiguration/SCDynamicStoreCopySpecificPrivate.h>
33 #include <SystemConfiguration/SCDynamicStoreSetSpecificPrivate.h>
35 #include <SystemConfiguration/SCPreferencesPrivate.h>
37 /* framework variables */
38 extern Boolean _sc_debug
; /* TRUE if debugging enabled */
39 extern Boolean _sc_verbose
; /* TRUE if verbose logging enabled */
40 extern Boolean _sc_log
; /* TRUE if SCLog() output goes to syslog */
46 @discussion Returns a last SystemConfiguration.framework API error code.
47 @result The last error encountered.
49 void _SCErrorSet (int error
);
52 @function _SCSerialize
53 @discussion Serialize a CFPropertyList object for passing
55 @param obj CFPropertyList object to serialize
56 @param xml A pointer to a CFDataRef, NULL if data should be
58 @param data A pointer to the newly allocated/serialized data
59 @param dataLen A pointer to the length in bytes of the newly
60 allocated/serialized data
62 Boolean
_SCSerialize (CFPropertyListRef obj
,
68 @function _SCUnserialize
69 @discussion Unserialize a stream of bytes passed from/to configd
70 into a CFPropertyList object.
71 @param obj A pointer to memory that will be filled with the CFPropertyList
72 associated with the stream of bytes.
73 @param xml CFDataRef with the serialized data
74 @param data A pointer to the serialized data
75 @param dataLen A pointer to the length of the serialized data
77 Specify either "xml" or "data/dataLen".
79 Boolean
_SCUnserialize (CFPropertyListRef
*obj
,
85 @function _SCSerializeString
86 @discussion Serialize a CFString object for passing
88 @param str CFString key to serialize
89 @param data A pointer to a CFDataRef, NULL if storage should be
91 @param data A pointer to the newly allocated/serialized data
92 @param dataLen A pointer to the length in bytes of the newly
93 allocated/serialized data
95 Boolean
_SCSerializeString (CFStringRef str
,
101 @function _SCUnserializeString
102 @discussion Unserialize a stream of bytes passed from/to configd
103 into a CFString object.
104 @param str A pointer to memory that will be filled with the CFPropertyList
105 associated with the stream of bytes.
106 @param utf8 CFDataRef with the serialized data
107 @param data A pointer to the serialized data
108 @param dataLen A pointer to the length of the serialized data
110 Specify either "utf8" or "data/dataLen".
112 Boolean
_SCUnserializeString (CFStringRef
*str
,
118 @function _SCSerializeData
119 @discussion Serialize a CFData object for passing
121 @param data CFData key to serialize
122 @param data A pointer to the newly allocated/serialized data
123 @param dataLen A pointer to the length in bytes of the newly
124 allocated/serialized data
126 Boolean
_SCSerializeData (CFDataRef data
,
131 @function _SCUnserializeData
132 @discussion Unserialize a stream of bytes passed from/to configd
133 into a CFData object.
134 @param data A pointer to memory that will be filled with the CFPropertyList
135 associated with the stream of bytes.
136 @param data A pointer to the serialized data
137 @param dataLen A pointer to the length of the serialized data
139 Boolean
_SCUnserializeData (CFDataRef
*data
,
144 @function _SCSerializeMultiple
145 @discussion Convert a CFDictionary containing a set of CFPropertlyList
146 values into a CFDictionary containing a set of serialized CFData
148 @param dict The CFDictionary with CFPropertyList values.
149 @result The serialized CFDictionary with CFData values
151 CFDictionaryRef
_SCSerializeMultiple (CFDictionaryRef dict
);
154 @function _SCUnserializeMultiple
155 @discussion Convert a CFDictionary containing a set of CFData
156 values into a CFDictionary containing a set of serialized
157 CFPropertlyList values.
158 @param dict The CFDictionary with CFData values.
159 @result The serialized CFDictionary with CFPropertyList values
161 CFDictionaryRef
_SCUnserializeMultiple (CFDictionaryRef dict
);
164 @function _SC_cfstring_to_cstring
165 @discussion Extracts a C-string from a CFString.
166 @param cfstr The CFString to extract the data from.
167 @param buf A user provided buffer of the specefied length. If NULL,
168 a new buffer will be allocated to contain the C-string. It
169 is the responsiblity of the caller to free an allocated
171 @param bufLen The size of the user provided buffer.
172 @param encoding The string encoding
173 @result If the extraction (conversion) is successful then a pointer
174 to the user provided (or allocated) buffer is returned, NULL
175 if the string could not be extracted.
177 char * _SC_cfstring_to_cstring (CFStringRef cfstr
,
180 CFStringEncoding encoding
);
184 @discussion Conditionally issue a log message.
185 @param condition A boolean value indicating if the message should be logged
186 @param level A syslog(3) logging priority.
187 @param formatString The format string
188 @result The specified message will be written to the system message
189 logger (See syslogd(8)).
191 void SCLog (Boolean condition
,
193 CFStringRef formatString
,
198 @discussion Conditionally issue a debug message.
199 @param condition A boolean value indicating if the message should be written
200 @param stream The output stream for the log message.
201 @param formatString The format string
202 @result The message will be written to the specified stream
205 void SCPrint (Boolean condition
,
207 CFStringRef formatString
,
212 @discussion Conditionally issue a debug message with a time stamp.
213 @param condition A boolean value indicating if the message should be written
214 @param stream The output stream for the log message.
215 @param formatString The format string
216 @result The message will be written to the specified stream
219 void SCTrace (Boolean condition
,
221 CFStringRef formatString
,
226 #endif /* _SCPRIVATE_H */