1 {
2  * Copyright (c) 2000-2005, 2008 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 {  Pascal Translation:  Peter N Lewis, <peter@stairways.com.au>, 2004 }
24 {  Pascal Translation Updated:  Jonas Maebe, <jonas@freepascal.org>, October 2009 }
25 {  Pascal Translation Updated:  Jonas Maebe, <jonas@freepascal.org>, October 2012 }
26 {
27     Modified for use with Free Pascal
28     Version 308
29     Please report any bugs to <gpc@microbizz.nl>
30 }
31 
32 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
33 {$mode macpas}
34 {$modeswitch cblocks}
35 {$packenum 1}
36 {$macro on}
37 {$inline on}
38 {$calling mwpascal}
39 
40 unit SCDynamicStoreCopySpecific;
41 interface
42 {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
43 {$setc GAP_INTERFACES_VERSION := $0308}
44 
45 {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
46     {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
47 {$endc}
48 
49 {$ifc defined CPUPOWERPC and defined CPUI386}
50 	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
51 {$endc}
52 {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
53 	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
54 {$endc}
55 
56 {$ifc not defined __ppc__ and defined CPUPOWERPC32}
57 	{$setc __ppc__ := 1}
58 {$elsec}
59 	{$setc __ppc__ := 0}
60 {$endc}
61 {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
62 	{$setc __ppc64__ := 1}
63 {$elsec}
64 	{$setc __ppc64__ := 0}
65 {$endc}
66 {$ifc not defined __i386__ and defined CPUI386}
67 	{$setc __i386__ := 1}
68 {$elsec}
69 	{$setc __i386__ := 0}
70 {$endc}
71 {$ifc not defined __x86_64__ and defined CPUX86_64}
72 	{$setc __x86_64__ := 1}
73 {$elsec}
74 	{$setc __x86_64__ := 0}
75 {$endc}
76 {$ifc not defined __arm__ and defined CPUARM}
77 	{$setc __arm__ := 1}
78 {$elsec}
79 	{$setc __arm__ := 0}
80 {$endc}
81 {$ifc not defined __arm64__ and defined CPUAARCH64}
82   {$setc __arm64__ := 1}
83 {$elsec}
84   {$setc __arm64__ := 0}
85 {$endc}
86 
87 {$ifc defined cpu64}
88   {$setc __LP64__ := 1}
89 {$elsec}
90   {$setc __LP64__ := 0}
91 {$endc}
92 
93 
94 {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
95 	{$error Conflicting definitions for __ppc__ and __i386__}
96 {$endc}
97 
98 {$ifc defined __ppc__ and __ppc__}
99 	{$setc TARGET_CPU_PPC := TRUE}
100 	{$setc TARGET_CPU_PPC64 := FALSE}
101 	{$setc TARGET_CPU_X86 := FALSE}
102 	{$setc TARGET_CPU_X86_64 := FALSE}
103 	{$setc TARGET_CPU_ARM := FALSE}
104 	{$setc TARGET_CPU_ARM64 := FALSE}
105 	{$setc TARGET_OS_MAC := TRUE}
106 	{$setc TARGET_OS_IPHONE := FALSE}
107 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
108 	{$setc TARGET_OS_EMBEDDED := FALSE}
109 {$elifc defined __ppc64__ and __ppc64__}
110 	{$setc TARGET_CPU_PPC := FALSE}
111 	{$setc TARGET_CPU_PPC64 := TRUE}
112 	{$setc TARGET_CPU_X86 := FALSE}
113 	{$setc TARGET_CPU_X86_64 := FALSE}
114 	{$setc TARGET_CPU_ARM := FALSE}
115 	{$setc TARGET_CPU_ARM64 := FALSE}
116 	{$setc TARGET_OS_MAC := TRUE}
117 	{$setc TARGET_OS_IPHONE := FALSE}
118 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
119 	{$setc TARGET_OS_EMBEDDED := FALSE}
120 {$elifc defined __i386__ and __i386__}
121 	{$setc TARGET_CPU_PPC := FALSE}
122 	{$setc TARGET_CPU_PPC64 := FALSE}
123 	{$setc TARGET_CPU_X86 := TRUE}
124 	{$setc TARGET_CPU_X86_64 := FALSE}
125 	{$setc TARGET_CPU_ARM := FALSE}
126 	{$setc TARGET_CPU_ARM64 := FALSE}
127 {$ifc defined iphonesim}
128  	{$setc TARGET_OS_MAC := FALSE}
129 	{$setc TARGET_OS_IPHONE := TRUE}
130 	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
131 {$elsec}
132 	{$setc TARGET_OS_MAC := TRUE}
133 	{$setc TARGET_OS_IPHONE := FALSE}
134 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
135 {$endc}
136 	{$setc TARGET_OS_EMBEDDED := FALSE}
137 {$elifc defined __x86_64__ and __x86_64__}
138 	{$setc TARGET_CPU_PPC := FALSE}
139 	{$setc TARGET_CPU_PPC64 := FALSE}
140 	{$setc TARGET_CPU_X86 := FALSE}
141 	{$setc TARGET_CPU_X86_64 := TRUE}
142 	{$setc TARGET_CPU_ARM := FALSE}
143 	{$setc TARGET_CPU_ARM64 := FALSE}
144 {$ifc defined iphonesim}
145  	{$setc TARGET_OS_MAC := FALSE}
146 	{$setc TARGET_OS_IPHONE := TRUE}
147 	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
148 {$elsec}
149 	{$setc TARGET_OS_MAC := TRUE}
150 	{$setc TARGET_OS_IPHONE := FALSE}
151 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
152 {$endc}
153 	{$setc TARGET_OS_EMBEDDED := FALSE}
154 {$elifc defined __arm__ and __arm__}
155 	{$setc TARGET_CPU_PPC := FALSE}
156 	{$setc TARGET_CPU_PPC64 := FALSE}
157 	{$setc TARGET_CPU_X86 := FALSE}
158 	{$setc TARGET_CPU_X86_64 := FALSE}
159 	{$setc TARGET_CPU_ARM := TRUE}
160 	{$setc TARGET_CPU_ARM64 := FALSE}
161 	{$setc TARGET_OS_MAC := FALSE}
162 	{$setc TARGET_OS_IPHONE := TRUE}
163 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
164 	{$setc TARGET_OS_EMBEDDED := TRUE}
165 {$elifc defined __arm64__ and __arm64__}
166 	{$setc TARGET_CPU_PPC := FALSE}
167 	{$setc TARGET_CPU_PPC64 := FALSE}
168 	{$setc TARGET_CPU_X86 := FALSE}
169 	{$setc TARGET_CPU_X86_64 := FALSE}
170 	{$setc TARGET_CPU_ARM := FALSE}
171 	{$setc TARGET_CPU_ARM64 := TRUE}
172 {$ifc defined ios}
173 	{$setc TARGET_OS_MAC := FALSE}
174 	{$setc TARGET_OS_IPHONE := TRUE}
175 	{$setc TARGET_OS_EMBEDDED := TRUE}
176 {$elsec}
177 	{$setc TARGET_OS_MAC := TRUE}
178 	{$setc TARGET_OS_IPHONE := FALSE}
179 	{$setc TARGET_OS_EMBEDDED := FALSE}
180 {$endc}
181 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
182 {$elsec}
183 	{$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
184 {$endc}
185 
186 {$ifc defined __LP64__ and __LP64__ }
187   {$setc TARGET_CPU_64 := TRUE}
188 {$elsec}
189   {$setc TARGET_CPU_64 := FALSE}
190 {$endc}
191 
192 {$ifc defined FPC_BIG_ENDIAN}
193 	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
194 	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
195 {$elifc defined FPC_LITTLE_ENDIAN}
196 	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
197 	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
198 {$elsec}
199 	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
200 {$endc}
201 {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
202 {$setc CALL_NOT_IN_CARBON := FALSE}
203 {$setc OLDROUTINENAMES := FALSE}
204 {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
205 {$setc OPAQUE_UPP_TYPES := TRUE}
206 {$setc OTCARBONAPPLICATION := TRUE}
207 {$setc OTKERNEL := FALSE}
208 {$setc PM_USE_SESSION_APIS := TRUE}
209 {$setc TARGET_API_MAC_CARBON := TRUE}
210 {$setc TARGET_API_MAC_OS8 := FALSE}
211 {$setc TARGET_API_MAC_OSX := TRUE}
212 {$setc TARGET_CARBON := TRUE}
213 {$setc TARGET_CPU_68K := FALSE}
214 {$setc TARGET_CPU_MIPS := FALSE}
215 {$setc TARGET_CPU_SPARC := FALSE}
216 {$setc TARGET_OS_UNIX := FALSE}
217 {$setc TARGET_OS_WIN32 := FALSE}
218 {$setc TARGET_RT_MAC_68881 := FALSE}
219 {$setc TARGET_RT_MAC_CFM := FALSE}
220 {$setc TARGET_RT_MAC_MACHO := TRUE}
221 {$setc TYPED_FUNCTION_POINTERS := TRUE}
222 {$setc TYPE_BOOL := FALSE}
223 {$setc TYPE_EXTENDED := FALSE}
224 {$setc TYPE_LONGLONG := TRUE}
225 uses MacTypes,CFBase,SCDynamicStore,MacOSXPosix,CFString,CFDictionary;
226 {$endc} {not MACOSALLINCLUDE}
227 
228 
229 { until the __IPHONE_NA is automatically handled }
230 {$ifc TARGET_OS_MAC}
231 
232 {$ALIGN POWER}
233 
234 {!
235 	@header SCDynamicStoreCopySpecific
236 	@discussion The functions of the SCDynamicStoreCopySpecific API
237 		allow an application to determine specific configuration
238 		information about the current system (for example, the
239 		computer or sharing name, the currently logged-in user, etc.).
240  }
241 
242 
243 {!
244 	@function SCDynamicStoreCopyComputerName
245 	@discussion Gets the current computer name.
246 	@param store An SCDynamicStoreRef representing the dynamic store
247 		session that should be used for communication with the server.
248 		If NULL, a temporary session will be used.
249 	@param nameEncoding A pointer to memory that, if non-NULL, will be
250 		filled with the encoding associated with the computer or
251 		host name.
252 	@result Returns the current computer name;
253 		NULL if the name has not been set or if an error was encountered.
254 		You must release the returned value.
255  }
SCDynamicStoreCopyComputerNamenull256 function SCDynamicStoreCopyComputerName( store: SCDynamicStoreRef; nameEncoding: CFStringEncodingPtr ): CFStringRef; external name '_SCDynamicStoreCopyComputerName';
257 (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
258 
259 {!
260 	@function SCDynamicStoreCopyConsoleUser
261 	@discussion Gets the name, user ID, and group ID of the currently
262 		logged-in user.
263 
264 		Note: this function only provides information about the
265 		      primary console.  It does not provide any details
266 		      about console sessions that have fast user switched
267 		      out or about other consoles.
268 	@param store An SCDynamicStoreRef representing the dynamic store
269 		session that should be used for communication with the server.
270 		If NULL, a temporary session will be used.
271 	@param uid A pointer to memory that will be filled with the user ID
272 		of the current console user. If NULL, this value will not
273 		be returned.
274 	@param gid A pointer to memory that will be filled with the group ID
275 		of the current console user. If NULL, this value will not be
276 		returned.
277 	@result Returns the user currently logged into the system;
278 		NULL if no user is logged in or if an error was encountered.
279 		You must release the returned value.
280  }
SCDynamicStoreCopyConsoleUsernull281 function SCDynamicStoreCopyConsoleUser( store: SCDynamicStoreRef; uid: uid_t_ptr; gid: gid_t_ptr ): CFStringRef; external name '_SCDynamicStoreCopyConsoleUser';
282 (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
283 
284 {!
285 	@function SCDynamicStoreCopyLocalHostName
286 	@discussion Gets the current local host name.
287 	@param store An SCDynamicStoreRef representing the dynamic store
288 		session that should be used for communication with the server.
289 		If NULL, a temporary session will be used.
290 	@result Returns the current local host name;
291 		NULL if the name has not been set or if an error was encountered.
292 		You must release the returned value.
293  }
SCDynamicStoreCopyLocalHostNamenull294 function SCDynamicStoreCopyLocalHostName( store: SCDynamicStoreRef ): CFStringRef; external name '_SCDynamicStoreCopyLocalHostName';
295 (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
296 
297 {!
298 	@function SCDynamicStoreCopyLocation
299 	@discussion Gets the current location identifier.
300 	@param store An SCDynamicStoreRef representing the dynamic store
301 		session that should be used for communication with the server.
302 		If NULL, a temporary session will be used.
303 	@result Returns a string representing the current location identifier;
304 		NULL if no location identifier has been defined or if an error
305 		was encountered.
306 		You must release the returned value.
307  }
SCDynamicStoreCopyLocationnull308 function SCDynamicStoreCopyLocation( store: SCDynamicStoreRef ): CFStringRef; external name '_SCDynamicStoreCopyLocation';
309 (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
310 
311 {!
312 	@function SCDynamicStoreCopyProxies
313 	@discussion Gets the current internet proxy settings.
314 		The returned proxy settings dictionary includes:
315 
316 		<TABLE BORDER>
317 		<TR>
318 			<TH>key</TD>
319 			<TH>type</TD>
320 			<TH>description</TD>
321 		</TR>
322 		<TR>
323 			<TD>kSCPropNetProxiesExceptionsList</TD>
324 			<TD>CFArray[CFString]</TD>
325 			<TD>Host name patterns which should bypass the proxy</TD>
326 		</TR>
327 		<TR>
328 			<TD>kSCPropNetProxiesHTTPEnable</TD>
329 			<TD>CFNumber (0 or 1)</TD>
330 			<TD>Enables/disables the use of an HTTP proxy</TD>
331 		</TR>
332 		<TR>
333 			<TD>kSCPropNetProxiesHTTPProxy</TD>
334 			<TD>CFString</TD>
335 			<TD>The proxy host</TD>
336 		</TR>
337 		<TR>
338 			<TD>kSCPropNetProxiesHTTPPort</TD>
339 			<TD>CFNumber</TD>
340 			<TD>The proxy port number</TD>
341 		</TR>
342 		<TR>
343 			<TD>kSCPropNetProxiesHTTPSEnable</TD>
344 			<TD>CFNumber (0 or 1)</TD>
345 			<TD>Enables/disables the use of an HTTPS proxy</TD>
346 		</TR>
347 		<TR>
348 			<TD>kSCPropNetProxiesHTTPSProxy</TD>
349 			<TD>CFString</TD>
350 			<TD>The proxy host</TD>
351 		</TR>
352 		<TR>
353 			<TD>kSCPropNetProxiesHTTPSPort</TD>
354 			<TD>CFNumber</TD>
355 			<TD>The proxy port number</TD>
356 		</TR>
357 		<TR>
358 			<TD>kSCPropNetProxiesFTPEnable</TD>
359 			<TD>CFNumber (0 or 1)</TD>
360 			<TD>Enables/disables the use of an FTP proxy</TD>
361 		</TR>
362 		<TR>
363 			<TD>kSCPropNetProxiesFTPProxy</TD>
364 			<TD>CFString</TD>
365 			<TD>The proxy host</TD>
366 		</TR>
367 		<TR>
368 			<TD>kSCPropNetProxiesFTPPort</TD>
369 			<TD>CFNumber</TD>
370 			<TD>The proxy port number</TD>
371 		</TR>
372 		<TR>
373 			<TD>kSCPropNetProxiesFTPPassive</TD>
374 			<TD>CFNumber (0 or 1)</TD>
375 			<TD>Enable passive mode operation for use behind connection
376 			filter-ing firewalls.</TD>
377 		</TR>
378 		</TABLE>
379 
380 		Other key-value pairs are defined in the SCSchemaDefinitions.h
381 		header file.
382 	@param store An SCDynamicStoreRef representing the dynamic store
383 		session that should be used for communication with the server.
384 		If NULL, a temporary session will be used.
385 	@result Returns a dictionary containing key-value pairs that represent
386 		the current internet proxy settings;
387 		NULL if no proxy settings have been defined or if an error
388 		was encountered.
389 		You must release the returned value.
390  }
SCDynamicStoreCopyProxiesnull391 function SCDynamicStoreCopyProxies( store: SCDynamicStoreRef ): CFDictionaryRef; external name '_SCDynamicStoreCopyProxies';
392 (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
393 
394 {$endc} {TARGET_OS_MAC}
395 
396 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
397 
398 end.
399 {$endc} {not MACOSALLINCLUDE}
400